File if exists or not.

October 17, 2010 at 22:23:58
Specs: Windows XP
I have to write a batch file which search in a default location for existance of file. The file name is dynamic according to date, but the starting part of the name is same for all. And at a time only one file will exist in that folder.

I wrote this code but then it says The system cannot find the file specified. The specified path has the file. I am putting in the code i have written. Can anyone please help.

SET filex=CAPM_payments_
FOR /F " tokens=* delims= " %%A IN ('DIR /tc D:\CinguLINC\New Folder\*.* ^| FIND "%filex%"') do set file=%%A

Thanks in advance if anyone can help me.

See More: File if exists or not.

October 18, 2010 at 05:12:42
If exist CAPM_payments_* echo yes

Life is too important to be taken seriously.


Report •
Related Solutions

Ask Question