If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Hello Guest,Our records indicate that you have never posted to our site before! Why not make your first post today by saying hello to our community in our Introductions forum.

Please review the forums rules, start with your first post today and become an active part of petri.co.il forums now!

So I'd guess you have made a typo or the directory is not accessible. Try taking a dir list of the directory contents and see if dir fails too.

FWIW, I have no knowledge about the biterScripting tool. The web page didn't have much info like online manual or the like. While biterScripting might have its uses, I'd advise to stick with more a mainstream tools like VBScript and Powershell. Way more support available for them.

Comment

However Wildcards are not disallowed for "If exist" statements you should be aware that the result when using a wildcard in DOS commands might not always turn out like expected.

e.g.
- create a test folder c:\test
- create a test file in the folder with the extension .txtzzz.
- Make sure no files with the extension .txt exists in that folder.
- Now when you run this:If EXIST "c:\test\*.txt" (echo FILE_EXIST) else (echo FILE DOES NOT EXIST)
The result will rather surprizingly be: "FILE_EXIST"!

Same you can test with other DOS commands like Dir and Del:Dir /b "c:\test\*.txt"Del "c:\test\*.txt"
(It didn't asked for confirmation for the deletion of each file because of the fact a file extention was entered here)
oeps! it deleted also the files from the folder with the extension .txtzzz

This happens when a wildcard is used instead of the name of a file while a file extension did was entered.
In this case the pattern of the file extension is assumed to be not more than 3 characters long.
For the first three characters an expected 'text compare' is used (the extension .tx does not match .txt), for the 4th and other characters that could exist an additional 'start_with compare' is used on these characters (therefore the entered extension .txt will also maches files that have the extension .txtzzz).
Luckily there aren't much filetypes with a file extension longer than three characters and which is containing the first three characters that is associated with an other filetype.

Anyways , that does still not explain why your first sample returns "FILE DOES NOT EXIST".
Could it perhaps be that in your actual batch c: is infact a driveletter one that is mapped to a network path - and, what you showed was also not the exact code from the batch?

About the results you have with the second batch sample:
The condition when using If Exist "c:\test\*" to check whether files exist in a folder is always TRUE when the folder exist, even when no files were located in that folder.
Because the 'if exist *.*' does also hit on a device file (NUL) then when examining the target folder (this does not occour on every kind of volume format though).

To check the existence of files (or specific file types) in a folder or tree you could use for example something like:

Comment

This script is exactly what I need, but little more of it.
I need script to search for configure.cfg under C:\Users\mike\AppData\Local\Trd
And if there script not finding configure.cfg than it must copy it from
c:\script\configure.cfg folder to folder C:\Users\mike\AppData\Local\Trd

Problem is because copying will be for differend users in diferred subfolder tree.
Script will be runned before user login.
So script must scan for folder Trd if there is that folder than check if configure.cfg exist
than skip, if configure.cfg not exist than copy configure.cfg from c:\script to C:\Users\mike\AppData\Local\Trd