Kategorien
News Operating Systems Windows

Robocopy

Syntax: robocopy source destination modifier-switches
All information can be accessed using robocopy /?

Copy Options:
/E copies subdirectories even when empty
/PURGE delete destination files/dirs that no longer exist in source
/MIR Mirror a directory tree = equivalent to /E plus /PURGE produces identical duplicate folders
Files or folders deleted in original will be deleted in the destination
/MT[:n] Do mulithreaded copies with n threads (default is 8) n>1 n<128

Retry Options:
/R:5 number of Retries on failed copies (default is 1 million)
/W:15 wait time 15 sec for each retry

Logging switches:
/NS no file sizes reported
/NC no class reported
/NFL no file list
/NDL no directory list
/NP no progress
/LOG:\directory\filename.txt starts (replaces) log file
/LOG+:\directory\filename.txt appends to existing log file

  • Note: Don’t use mapped drive paths!
  • Note: Use Quotes for any path that includes a space like “\server\office docs”
  • Note: Do not call the text file robocopy.bat
  • Note: Remember to create directory c:\robologs
robocopy \\Source\Folder Z:\DestinationFolder /MIR /MT /R:5 /W:15 /NS /NC /NFL /NDL /NP /LOG+:\robologs\log.txt
  • create a .bat file and run as an administrator
  • The best way is to use a task scheduler : schedtasks