Skip to content

Instantly share code, notes, and snippets.

@0XDE57
Created January 29, 2021 00:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0XDE57/add96ef6a5bbc355096d3a0068e6b324 to your computer and use it in GitHub Desktop.
Save 0XDE57/add96ef6a5bbc355096d3a0068e6b324 to your computer and use it in GitHub Desktop.
backup script (double check paths before running)
::robocopy C:\source M:\destination /MIR /FFT /R:3 /W:10
::/MIR option (equivalent to /E /PURGE) stands for "mirror" and is the most important option.
::It regards your source folder as the "master", causing it to overwrite any changes on the target side, which is a useful setting for a backup.
::/FFT is a very important option, as it allows a 2-second difference when comparing timestamps of files, such that minor clock differences between your computer and your backup device don't matter. This will ensure that only modified files are copied over, even if file modification times are not exactly synchronized.
::/R:3 specifies the number of retries, if the connection should fail, and /W:10 specifies a wait time of 10 seconds between retries. These are useful options when doing the backup over a network.
::/Z copies files in "restart mode", so partially copied files can be continued after an interruption.
::credit: superuser.com/a/831868
robocopy D:\ G:\ /MIR /FFT /R:3 /W:10 /Z /XJD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment