Introducing Robocopy

Robocopy, or “Robust File Copy”, is a file copying command that provides more resilient and reliable copying functionality than the standard Windows copying functions using the Windows Explorer GUI. Some of the reasons it is a superior option include that it:

  • Can tolerate network interruptions and resume copying
  • Is more reliable when copying the file data and its attributes
  • Can copy files and folders with file paths longer than 256 characters
  • Has lots of customization options for how to carry out the copying
  • Provides a report at the end of the copying process

The customization options include choices about the file attributes to copy, whether to copy empty folders or not, and the ability to schedule copying for a particular time. This is particularly useful if copying a large amount of data as it can be scheduled for times your network is quieter (e.g. at night). As with other commands, the full list of options is available by typing help robocopy into the Command Prompt.

The robocopy Command

As mentioned above, there are lots of ways to customize the robocopy command, but we are going to concentrate on a relatively simple version of the command. The structure for this is as follows:

robocopy [source folder] [destination folder] [options]

Below is an example of a full command. Here we have written the command to tell the computer to copy the contents of the “ExampleFolder” to the folder “CopyExample” (if the folder we want to copy to does not already exist, the computer will create it). We have also included an instruction, “/e”, that we want all of the sub-folders copied, including those that are empty (so we copy the folder structure exactly).

robocopy “C:\users\sharo\documents\examplefolder” “C:\users\sharo\documents\copyexample” /e

Note that here we have included the full folder file path in inverted commas. Supplying the source and destination folders in this form ensures accuracy when the computer executes the command.

Report from robocopy CommandAn example of the report produced after completing a robocopy command

Above we noted that after executing a robocopy command you will receive a report on the process. The image on the right shows an example report after executing the command.

It lists how many folders (directories) were copied, how many files, their total size, and if any were skipped or failed, along with other more detailed information. This provides clear confirmation of the success (or otherwise) of the copy action.

Now it is time to try the robocopy command yourself.