Windows Robocopy
Post date: Sep 09, 2011 12:2:10 AM
...is a Windows CLI tool that is awesome for backup and replication purposes. It lets you copy entire folder structures with their time stamps and security permissions intact - something no other native Windows command does. More than that, it can verify the source against the target and only copy the delta, i.e. the new and changed files - great if you only need to update a previous backup rather than do a whole new one.
There are several resources dedicated to robocopy:
Microsoft robocopy reference for Windows Server 2008 -- microsoft.com, Aug 19, 2008
Robocopy -- Wikipedia
How to Perform Multithreaded File Copies with Robocopy in Windows 7 -- Microsoft TechNet Magazine
Being CLI (Command Line Interface), the tool has a lot of flags or parameters to specify exactly what you want to do. The format that worked for my purposes was:
robocopy [source folder] [target folder] /e /sec /dcopy:T /r:3 /w:1 /log+:[log file] /np
The flags stand for:
/e -- Copies sub-directories, including empty ones.
/sec -- Copies files with security
/dcopy:T -- Copies directory time stamps.
/r:3 -- limits the number of retries to 3. The default value is 1 million.
/w:1 -- limits the wait time between retried to 1 second. The default value is 30 (seconds).
/log+:[log file] -- Writes the status output to the log file (appends the output to the existing log file).
/np -- do not display or log the individual file copy progress (which results in excessive junk characters in log files).
Example:
You would like to copy the entire contents of your Android phone folder structure (mounted as a drive letter "P:") to a backup folder "N:\backup\Android", and append the log of the command to "N:\backup\Android.log" file without overwriting it:
robocopy P: N:\backup\Android /e /sec /dcopy:T /r:3 /w:1 /log+:N:\backup\Android.log /np
Note that robocopy is not exactly backup. For example, an incremental backup process provides for storing multiple versions of the same file that is current as of the date of the backup. Robocopy does not have a mechanism for that. However if the purpose is to quickly and efficiently mirror folder structures across volumes - it is a very efficient and practical tool.
(Thank you Dan Henrickson and Arlys Alford for tipping me to this awesome tool.)