Batch file using For command
Posted on 2013-01-28
I am trying to create a batch file that will search a directory for a specific subdirectory then move the subdirectory and all files within to different folder.
I attempted the command below and I have not been able to make this work.
FOR /R <filepath1> %%G IN (1-1049780) DO "robocopy.exe /move %%G <filepath2>
Note: 1-1049789 is the directory name that I wish to move. I am using excel and the concatenate function to create a batch file that has the above command for over 20k entries. I will have a batch file that has 20k entries that will need to run. I wanted to attempt querying a file, but was not sure of the proper syntax for the command.
Can anyone confirm that the directory name in parenthesis is going to be read as a folder name and not a range of values?
There may be a better way to do this using VBscript, and I am open to any suggestions that you have.
Thanks in advance for any assistance you can provide.