Copy Data Using robocopy to Sync Local and Remote Directories

  1. Knowledge Base
  2. Systems Administration
  3. Backup
  4. Copy Data Using robocopy to Sync Local and Remote Directories

First step is to map your share path via a Drive Letter “\\Sever\Share\Destination\Path”, ie: Z:\

Open a Windows Command line prompt and enter the command:

robocopy C:\Source\Path Z:\Destination\Path /v /e /copy:DAT /dcopy:T /LOG:yyyyMMddHHmmss-MeaningfulLogFileName.txt

Sometimes after a copy completes, there will be some files that fail to copy. Be sure to check the log files. If there are files that fail to copy, you have compare the source and destination folders. To use robocopy to compare two folders without any data transferring, you may do so using the robocopy differential “diff” command as follows to produce a reconciliation log file, see instructions here.

Multi-Threading and Bandwidth Utilization

Robocopy can even send multiple files at a time, decreasing the time it takes to complete a backup or synchronization. The /mt:n flag is used to indicate the number of simultaneous transfers.

Flag Definitions

/e        copies subdirectories including empty directories
/v        prints verbose output including all skipped files
/copy:DAT file properties to be copied: D for Data, A for Attributes and T for Time stamps
/dcopy:T  preserves time stamps
/LOG:{filename} specify filename or path
/ns       no log file sizes 
/njs      no job summary
/njh      no job header
/ndl      directory names not logged
/fp       include full path names
/l        fields are to be listed only, they will not be copied, deleted, or time stamped
/mt:n     Enables multi-threaded copying with n threads. 

Leave a Reply

Your email address will not be published. Required fields are marked *