Robocopy has option
/XD for excluding a list of directories:
/XD "C:\Windows" "C:\Windows.old"
You can get a list of
robocopy commands, creating a text file on your desktop via:
Robocopy /? > "%USERPROFILE%\desktop\robocopy_commands.txt"
- If you want a current backup where both copies are identical, use the
/MIR to "mirror" the versions, which will delete files on the backup copy (destination) that are no longer present on the original copy (source);
/MIR is a short-hand combination of
- If you use the
/L option, this will list what will happen, but won't actually do the move or copy, which is useful for testing your script before actually taking the time to copy stuff.
Robocopy, at least when using
/MIR, is restartable and does not re-copy things which have not changed.
To avoid massive slowdowns from problems opening or accessing files, I usually set the retries to some small number and the retry wait to a small interval, like
/R:2 /W:2, and then check the log file for failures, handling those manually.