Skip to content

Instantly share code, notes, and snippets.

@archagon
Last active January 22, 2024 03:38
Show Gist options
  • Star 27 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save archagon/5791332 to your computer and use it in GitHub Desktop.
Save archagon/5791332 to your computer and use it in GitHub Desktop.
A bunch of robocopy flags to help backup an external drive.
robocopy /b /e /xa:s /xjd /sl /a-:hs /mt /v /fp /eta /log:"D:\To\Directory\transfer.log" /tee "C:\From\Directory" "D:\To\Directory"
(Note that the paths don't have a trailing backslash.)
/b -- backup mode (there's a /zb option for restart mode, but it's a whole lot slower)
/e -- copies subdirectories (including empty directories) in addition to files
/xa:s -- exclude system files
/xjd -- exclude junction points
/sl -- copy symbolic links as links
/a-:hs -- remove hidden/system attributes from files
/mt -- multithreaded
/v -- verbose output + skipped
/fp -- full path of files in output
/eta -- time remaining
/log:logfile.txt -- redirect output to file
/tee -- duplicate log to console window
By default, data, attributes, and time stamps are copied. ACL permissions, owner information,
and auditing information are ignored. (You can modify this behavior with the /copy flag.)
Some potentially helpful regexes for the log:
^\s*New File.*?\n
^\s*?\d+[%].*?\n
^\s*New Dir.*?\n
@JohnAstronomer
Copy link

Logfile Analysis'
Unchanged folders always start with a number - if you create a analysis script to exclude all the lines starting with a number you will only see the changes and the summary text in the result. It's easier than using the regexes above that may miss some things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment