Robocopy is a powerful Windows command-line tool designed for copying large files and directories while preserving directory structure, access permissions, and other attributes. When transferring data between servers, Robocopy ensures that all critical information is safely and efficiently migrated to the new server.
I used this tool to move our important file servers from older Windows 2012 systems to the newer Windows 2019. I combined it with the net use
command to connect to remote drives and Group Policy to copy over permissions. This guide shows you how to use Robocopy to get ready for a similar server upgrade
Understanding Robocopy Command
robocopy “D:” “Z:” /E /ZB /XF /SEC /COPYALL /R:1 /W:1 /MT:8 /LOG:”C:\Temp\robocopy_log.txt”
- robocopy “D:” “Z:”: Specifies the source (D:) and destination (Z:) of the copy operation.
- /E: Copies all subdirectories, including empty ones.
- /ZB: Uses restart mode, handling errors related to open files.
- /XF: Excludes files with specified extensions. Add extensions you want to exclude here.
- /SEC: Copies security settings (NTFS permissions).
- /COPYALL: Copies all attributes (data, attributes, times).
- /R:1: Retries 1 time if an error occurs.
- /W:1: Waits 1 second before retrying.
- /MT:8: Uses up to 8 threads to increase copy speed.
- /LOG:”C:\Temp\robocopy_log.txt”: Logs activity to the “robocopy_log.txt” file in the C:\Temp directory.
In summary: This command will copy the entire contents of drive D: to drive Z:, including subdirectories, access permissions, and other attributes. The copy process will be performed safely and efficiently, and a detailed log will be created.