Need Wildcard help
Posted: 01 Feb 2012 16:44
All,
I have written a batch file to loop through a directory, but only retrieve and copy files with names that contain the strig 'APR_DATA'. TO get the listing, I use *APR_DATA*.txt, as the string is in the middle of the file name. When I run it, however, it appears to return all of the files in the directory. THe wildcards work from just a regular DOS command line. Here is the text of my batch file. Any ideas why it's not working?
for /f "\\win2kdevfs1\sharedfolders$\FTP\LOAD\APR_DRG\" %%i IN (*APR_DATA*.txt) DO call :moveit %%i
:moveit
IF NOT EXIST '\\dwbaseline\ETLSourceFiles\FlatFiles\Test\%1' COPY \\win2kdevfs1\sharedfolders$\FTP\LOAD\APR_DRG\%1 \\dwbaseline\ETLSourceFiles\FlatFiles\Test\%1
I have written a batch file to loop through a directory, but only retrieve and copy files with names that contain the strig 'APR_DATA'. TO get the listing, I use *APR_DATA*.txt, as the string is in the middle of the file name. When I run it, however, it appears to return all of the files in the directory. THe wildcards work from just a regular DOS command line. Here is the text of my batch file. Any ideas why it's not working?
for /f "\\win2kdevfs1\sharedfolders$\FTP\LOAD\APR_DRG\" %%i IN (*APR_DATA*.txt) DO call :moveit %%i
:moveit
IF NOT EXIST '\\dwbaseline\ETLSourceFiles\FlatFiles\Test\%1' COPY \\win2kdevfs1\sharedfolders$\FTP\LOAD\APR_DRG\%1 \\dwbaseline\ETLSourceFiles\FlatFiles\Test\%1