Copy Permissions and Files At the Same Time
A sample script to copy files along with permissions using robocopy
robocopy \\<server>\<share> T:\<share> /COPYALL /ZB /R:2 /W:2 /E
- \\<server>\<share> – Provide the source location.
- T:\<share> – Provide the destination/target location where it’s being copied to.
- /COPYALL – Copy the shares and permissions
- /DCOPY:DAT — Copies folder-level timestamps and ACLs/permissions. This is separate from COPYALL which only handles files.
- /ZB – Restartable mode just in case if there is a network hiccup during copy intervals.
- /R:2 – the number of retries in case the file is in use or has a problem
- /W:2 – the number of seconds to wait between retries
- /E – Copy everything including subfolders and empty subfolders
- /MT:8 — Uses 8 parallel threads so multiple files copy at the same time, much faster than the default single thread.
- /MT:16 — Uses 16 parallel threads so multiple files copy at the same time, much faster than the default single thread.
- /LOG+ — Appends all results to a log file so you have a record of what copied and what failed.
- /TEE — Shows output on screen and writes to the log file at the same time.
- /MIR — Added to catch up on anything new or changed since the first copy. Ensures both servers are identical before cutover
Intial sync
robocopy “\Server2008\Share” “\Server2019\Share” /COPYALL /DCOPY:DAT /ZB /R:3 /W:5 /E /MT:8 /LOG+:”C:\Logs\robocopy.log” /TEE
Final/delta migration would be just adding changes
Added to catch up on anything new or changed since the first copy. Ensures both servers are identical before cutover
robocopy “\Server2008\Share” “\Server2019\Share” /COPYALL /DCOPY:DAT /ZB /R:3 /W:5 /E /MIR /MT:16 /LOG+:”C:\Logs\robocopy_final.log” /TEE

