Here are a few tips/caveats about using Robocopy.
In a nutshell its a great tool.
1. Using the /MIR switch will delete files & directories from the destination directory if it is not empty. This is because the MIR switch makes the destination directory an exact mirror image of the source directory
2. By default, Robocopy copies the NTFS permissions from the source directory to the destination directory. This is not a problem. However, consider this scenario - if you copy files from one server to another using UNC paths and only a specific administrator account has access to the files on the source server and that administrator account does not exist on the destination server then you will have to reset the permissions on all files on the destination server. We recently had to do this for 1.5 TB worth of data which took a couple of hours. We should have set Permission Inheritance on the destination server and copied the files using the /COPY:DAT switch instead of the default /COPY:DATS
3. It is good to run Robocopy in the Simulation mode first (use the /L switch) to detect any security/access errors early
4. Use the /B switch to override ACLs and give the administrator access to all files, even if the ACL does not permit so
5. When copying over WAN connections run multiple instances of Robocopy with the same source and destination UNC paths. This will improve the throughput and will not lead to any data loss or corruption
6. To schedule robocopy jobs use the Windows Task Scheduler instead of the robocopy /RH switch. This gives you better control over when the job starts and how frequently and for how long it runs. Use the /LOG+ switch instead of /LOG to append to the log file if the robocopy job runs multiple times
7. The default values of the /R and /W parameters are useless. If a file cannot be copied for some reason then robocopy will try a million times and wait for 30 seconds between retries. You may want to change this :)
8. Copying files locked by other applications and services is a bit tricky, see - http://blogs.msdn.com/adioltean/arch...18/761515.aspx. You shouldn't be doing this anyway, because it can lead to corrupt backup state for such files.
9. The use of the /E switch and the /MAXAGE switch will create all the sub-directories in the source in the destination directory, even if NO files in those sub-directories will be copied
10. Be careful, by default, if a MORE RECENT file with the same name exists in the destination folder, IT WILL BE OVERWRITTEN. Use the /XO - exclude older, switch to avoid this, if required.
Hope this helps
- Paras Jethwani
Thanks for that very thorough and probably worth a wiki entry.