Just wondering the best way to do this in a single batch file. I have a folder called C:\Program\Foo and I want to grab all the folders except for the testing folder inside of foo, and I want to xcopy into D:\ so in D:\ foo will be there but no test folder.
Is there a way I can loop through each folder and check for a certain name not to include?
using /Exclude would mean I would need an extra text file with “Testing” in it
I don’t see why you could not create a temporary exclusion file (using a temporary folder, that is):
Note:
XCOPYdoes not recognise double quotes as path delimiters in the/EXCLUDEoption and offers no alternative for specifying paths with spaces, which can be a problem on Windows XP systems. This limitation can be worked around by replacing the original path with its counterpart consisting only of short names. That is what theFORloop in the above script does for the%TEMP%folder.