Robocopy is a Windows command line tool used to make copies of files and folders. This is one of my favourite tools, and it comes free as part of Windows Server Resource kit – or can be downloaded from Microsoft’s web site(rktools.exe – 11.8M). It has been part of Windows OS from Windows Vista.

Robocopy provides the ability to make mirror copies of folders/directories as well as to synchronise file(s) by copying any changes after comparing a file’s size or time stamp. It also provides the ability to copy locked file(s) i.e file(s) in use, which is not possible with Xcopy or the Copy command.

Below is the Robocopy usage

Robocopy source destination [File [file] … ] [options]

Source Source directory path (i.e local or network path)
Destination Destination directory path (i.e local or network path)
File Name of file to act upon
Options Options to use to accomplish the intended task

For more information on options usage, please visit Microsoft Technet page. (Note:Page opens in new window).

To use “Robocopy” to move/migrate folder(s)/directory(ies) from one server to another or to another location.

Run the command below at the command prompt (This ensures that Robocopy is located at c:\Windows\System32)

robocopy source_location target_location /MIR /E /Z /LOG:C:\Robocopylog.txt /TEE /R:2 /W:0

/MIR Mirrors a directory tree
/E Copies all subdirectories including empty ones.
/Z Copies files in restartable mode (that is, restarts the copy process from the point of failure).
/LOG: Generates a log file name robocopylog.txt
/TEE Logs to file as well as to the console
/R:0 Number of times to retry copying a locked file
/W:0 Time in between retry attempts

[asa2 tpl=”Book”]0672336227[/asa2]