How To Use Robocopy To Sync Backup Files In Windows 7?
OK, the Windows Backup program bundled with Windows 7 is better than the one offered by Windows Vista. The new Backup and Restore allows user to decide which folders to include in the backup, instead of which file types, as what is seen in Windows Vista.
However, it is still not good enough to meet my backup requirement. And so is you, I believe.
My backup plan is not complicated. Indeed, I just would like Windows to synchronize backup files in USB hard disk with those data files in local hard disks of Desktop and laptop.
Having said that, the content of backup drive (destination) and backup source will be the same when the backup program completes its job (theoretically is 100%, suppose that there is no change in the source when backup in progress).
So, if not using Backup and Restore program, what program I can use to create a sync backup? The answer is using Robocopy, a command-line utility program bundled with Windows Vista as well as the latest Windows 7.

If you type
Don’t worry. Here is the sample of using Robocopy mirroring function, that I use at least once a day to sync data files in Desktop and laptop to the USB hard disk drive:
Where C:\WalkerData is the backup source and G:\WalkerData is the backup destination.
Using the sample at above, you can simply modify the backup source and destination for your case. You can also save it to a command file (.cmd) to save typing the Robocopy backup options again and again.
My backup plan is not complicated. Indeed, I just would like Windows to synchronize backup files in USB hard disk with those data files in local hard disks of Desktop and laptop.
Having said that, the content of backup drive (destination) and backup source will be the same when the backup program completes its job (theoretically is 100%, suppose that there is no change in the source when backup in progress).
To create a sync backup is like using a RAID-1 disk mirroring, means having the backup program to copy new or newer files to backup drive, at the same time delete those files in backup drive that are no longer exist in backup source.
So, if not using Backup and Restore program, what program I can use to create a sync backup? The answer is using Robocopy, a command-line utility program bundled with Windows Vista as well as the latest Windows 7.
If you type
robocopy /? in Command Prompt window, the long list of Robocopy command options probably would keep you fainted for a while.Don’t worry. Here is the sample of using Robocopy mirroring function, that I use at least once a day to sync data files in Desktop and laptop to the USB hard disk drive:
robocopy C:\WalkerData G:\WalkerData /MIR /ZB /R:3 /V /FP /LOG:D:\sync.log /TEE
Where C:\WalkerData is the backup source and G:\WalkerData is the backup destination.
/MIR– MIRror a directory tree (equivalent to /E plus /PURGE). This option does exactly what I want to the backup plan to be.
/ZB– use restartable mode; if access denied use Backup mode. This option is not necessary, anyway. Restartable mode is useful for copying files over network (if the link drop). Backup mode is simply means allow files to be opened without security restrictions (Robocopy in Windows 7 is still not using Volume Shadow Copy or VSS service to copy open file). NOTE: you need elevated privilege to use backup mode option (or the combined /ZB option).
/R:3is useful to restrict number of retries on failed copies to only 3, instead of the default 1 million :-)
/Voption produces Verbose output, showing skipped files. It’s good to see how well Robocopy performs in Command Prompt window.
/FPoption includes Full Pathname of files in the output.
/LOG:means to create or overwrite the specified log file of job done by Robocopy. To append, instead of overwrite, use/LOG+:option.
/TEEoption means to show whatever log to the log file to the standard output as well (in this case, the standard output is Command Prompt window).
Using the sample at above, you can simply modify the backup source and destination for your case. You can also save it to a command file (.cmd) to save typing the Robocopy backup options again and again.
Custom Search






























Thanks for that Walker — I have made the script, but in win7 my user is set to the Administrator type, but when I try the script I’m told I do not have Backup and Restore user rights. Is there a way to make my account have those rights? Is this because I have Win7 Premium instead of Pro?
Thanks,
Carl
carlspanoghe.com
Ops, sorry. Forgot to mention that with Windows Vista, Windows 7, Windows Server 2008, or above, you need to run robocopy in Command Prompt with elevated privilege.