How do I use robocopy with a large number of excluded files?
Solution 1:
There is a limit on command line length (I think it is something like 2048 characters) in windows.
You should generate a job file with a small subset of the exclusion list specified (using the /save:filename
argument) to get the syntax, edit the file to include the full list, and then use the /job:filename
argument to run it.
For reference, the documentation for this tool can be found here.
Solution 2:
Turns out that the robocopy job file syntax is not that complicated.
For your specific situation you can achieve what you want by creating a robocopy job file with the following content:
/XD
exclude1.ext
exclude2.ext
exclude3.ext
....
If you'd want to do the same for files too, then your robocopy job file would look like this:
/XD
exclude1.ext
exclude2.ext
exclude3.ext
....
/XF
file1.ext
file2.ext
file3.ext
....
By using the same logic you can move any other options from the command line to the job file.