Need to replace one of your file servers? Maybe you’re migrating from Server 2008 to 2012/2016.
Use this command to copy your files from one server to another keeping ACL permissions, owner info, timestamps etc. intact:
robocopy source destination /E /ZB /DCOPY:T /COPYALL /R:1 /W:1 /V /TEE /LOG:C:\copy.txt
(remember – robocopy knows how to handle UNC paths, also)
Best of luck with the rest of your migration!
Explanation of switches:
/E – copies subdirectories, including empty ones
/ZB – use restartable mode; if access denied use Backup mode (useful for locked files)
/DCOPY:T – copies timestamps for the directories
/COPYALL – copies: attributes, timestamps, ACL permissions, owner info, audit info
/R:1 – number of retries
/W:1 – wait time between retries
/V – verbose output
/TEE – output to console, as well as log file
/LOG:C:\copy.txt – log file location