I want to use robocopy to move a large number of files, except those that are in a whitelist. The whitelist contains approximately 150 files of different names. When I copy-and-paste the whitelist's filenames into the command line (using the /xf
parameter), robocopy truncates the list.
c:\test> robocopy src dest *.ext /xf exclude1.ext exclude2.ext exclude3.ext ... exclude 299.ext exclude300.ext
Results in:
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : Fri May 24 14:09:31 2013
Source : C:\test\src\
Dest : C:\test\dest\
Files : *.ext
Exc Files : exclude1.ext
exclude2.ext
exclude3.ext
....
....
exclude200.ext
exclude201.ext
exclu
and then:
'exclude250.ext' is not recognized as an internal or external command,
operable program or batch file.
'exclude251.ext' is not recognized as an internal or external command,
operable program or batch file.
'exclude252.ext' is not recognized as an internal or external command,
operable program or batch file.
'exclude253.ext' is not recognized as an internal or external command,
operable program or batch file.
Unfortunately the files in the whitelist are hand-picked and can't be filtered by wildcards.
Is there a way to get around this?
Best Answer
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.