Robocopy Command to Do an Incremental Backup
I Am Overwhelmed by the Robocopy Documentation. I Want to Do an Incremental Backup of My Local Files to the Network Drive (M). I Want It to Run as Quickly as...
I am overwhelmed by the ROBOCOPY documentation. I want to do an incremental backup of my local files to the network drive (M). I want it to run as quickly as possible, with no log file and with as little text as possible to the screen. My files are all somewhere inside one folder (MyFolder) that has many nested subfolders. By "incremental" I mean "only copy what is new or changed." I don't want to delete any historical files in the destination, but if I've changed a file I only want the newer version. And if I have not changed a file, then I don't want to copy it over the existing backed-up file. Is below correct? (Running Win7 Enterprise.)
robocopy C:\MyFolder M:\MyFolder /z /np /xo /e
Please, no suggestions for anything but robocopy. I'm not allowed to install anything. And I don't care about security stuff. I have people for that (whether I want them or not). ;-)
2 Answers
I have been successfully using a variant of the following script for a few years now:
robocopy C:\source M:\destination /MIR /FFT /R:3 /W:10 /Z /NP /NDL
Must Read
Parameters explained
The
/MIRoption (equivalent to/E /PURGE) stands for "mirror" and is the most important option. It regards your source folder as the "master", causing robocopy to copy/mirror any changes in the source (new files, deletions etc.) to the target, which is a useful setting for a backup./FFTis 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:3specifies the number of retries, if the connection should fail, and/W:10specifies a wait time of 10 seconds between retries. These are useful options when doing the backup over a network./Zcopies files in "restart mode", so partially copied files can be continued after an interruption./NPand/NDLsuppress some debug output, you can additionally add/NS,/NC,/NFLto further reduce the amount of output (see the documentation for details). However, I would suggest to print some debug output during the first runs, to make sure everything is working as expected.