IF EXIST with wildcards
Posted: 26 Nov 2009 01:47
I'm trying to create a batch file using IF EXIST that searches for a specified file. The sub directory name changes everyday. If the sub directory name is hard coded then it works. I tried using a wild card for the sub directory and it doesn't work. Is it possible to use wild cards in this situation?
The temp2 directories are named like this:
temp2_11-20-09
temp2_11-21-09
temp2_11-22-09
temp2_11-23-09
temp2_11-24-09
@echo off
IF EXIST c:\temp\temp2*\test.txt (
echo "File exists"
) ELSE (
echo "file does not exist"
)
The temp2 directories are named like this:
temp2_11-20-09
temp2_11-21-09
temp2_11-22-09
temp2_11-23-09
temp2_11-24-09
@echo off
IF EXIST c:\temp\temp2*\test.txt (
echo "File exists"
) ELSE (
echo "file does not exist"
)