Robocopy: Best practices for working with this helpful Windows utility

As someone who grew up using the old DOS “copy” command, copy is often my go to when I only need to copy a few files. However, Windows includes another file copy utility called Robocopy. Robocopy is far superior to the old copy command, and is well-suited to the task of performing large or complex file copy operations.

As useful as Robocopy may be, however, it can be a bit complicated to use. Entering the Robocopy /? command reveals dozens of command line switches. If you don’t use Robocopy on a regular basis, it can sometimes be tough to figure out which switches are best suited to completing the task at hand. That being the case, I wanted to take the opportunity to explain the switches that I tend to use the most often. Keep in mind that this is by no means intended to be a comprehensive discussion of the available command line switches, but rather a discussion of some of the ones that I find to be most useful.

Copying file attributes


The Robocopy utility includes a /COPY switch that allows you to specify exactly which parts of the file you want to copy. This gives you a way of making sure that the copied data retains the original date and time stamp, security permissions, and that sort of thing.

When you use the /COPY switch, you are required to specify one or more flags that tell Robocopy what to copy. Those flags are:

D – Data
A – Attributes
T – Timestamps
S – NTFS ACL Security
O – Owner
U – Auditing information

The nice thing about having so many flags available to you is that it allows for very granular control over the copy process. The disadvantage however, is that it can be tedious to have to use so many different flags. Thankfully, there are some shortcuts available.

If you want to make sure that you retain the most commonly used components (Data, Attributes, Timestamp, and Security), you can use the /SEC switch. It does exactly the same thing as using /COPY:DATS

If you are like me and want to retain all of the file’s various attributes, then you can use the /COPYALL switch instead. This is the equivalent to using /COPY:DATSOU



If you are going to be copying a group of files, then there is a good chance that you will also need to copy any subdirectories that may be present. You can tell Robocopy to copy these subdirectories by including the /S switch. However, I recommend using the /E switch instead.

The difference between these two switches is that if you use the /S switch, then Robocopy will only copy subdirectories containing data, but will ignore any empty subdirectories. While that may be fine in some situations, my philosophy has always been that even if a subdirectory is empty, there is a reason why it exists. Perhaps an application occasionally looks to that subdirectory to see whether or not a particular file exists. Using the /E switch instead of the /S switch ensures that the resulting copy will have a directory structure that perfectly mimics that of the original data.

Preventing errors


It’s no fun to start a large copy operation, and then come back a few hours later to discover that the operation has failed for some reason and that you have to start over again. Fortunately, Robocopy provides some tools for avoiding these frustrating situations.

The first of these options is something called Restartable Mode. Restartable Mode can be enabled using the /Z switch, and is well suited to situations in which you need to copy large files over a potentially unreliable network. If the file transfer fails, then Restartable Mode allows the transfer to be resumed from the point of failure, rather than requiring it to be restarted from the beginning.

A second option is to use Backup Mode. Backup Mode can be enabled by using the /B switch, and is useful for overcoming permissions related errors. If you are copying user data, then there is a chance that you might not have permission to access all of the user’s files. Normally, this would cause the file copy process to fail.

Backup Mode overcomes this problem by treating the file copy process as a backup operation, essentially ignoring any permissions related issues. In order to use Backup Mode however, you do have to be using Robocopy from within an administrative command prompt and you need to have backup privileges.

The Restartable Mode and the Backup Mode options are mutually exclusive, which means that you can choose to use one or the other, but not both. Even so, there is a way to get the best of both worlds. Rather than using the /Z switch or the /B switch, use /ZB instead. This tells Robocopy to use Restartable Mode, but to switch to Backup Mode if it encounters a permissions problems.
While I am on the subject of error prevention, I want to quickly mention the /TIMEFIX and /SECFIX switches. These switches tell Robocopy to fix time errors and security errors on files. Robocopy can even fix these errors on files that it skips.


One last thing that I wanted to mention is that there is Robocopy includes a switch that you may be able to use to decrease the amount of time that the copy process takes to complete. The switch is called /MT, and it is used to specify the number of threads used by the copy process. By default, Robocopy distributes the copy process across eight threads, but you can increase the thread count to as much as 128.

Obviously, increasing the thread count won’t help in every situation. If the storage device is running at its maximum I/O capacity for instance, then using extra threads isn’t going to do anything to improve performance. In some cases though, using extra threads can help.

Robocopy: A lot of uses

While it is easy to think of Robocopy as a tool for copying files from Point A to Point B, it can also be used for migrations. Robocopy has the ability for example, to monitor a source for changes and then replicate those changes to a destination. While there are admittedly some third-party tools that really take the copy process to the next level, Robocopy is an excellent choice if you want to stick to using native tools.

Featured image: Shutterstock

About The Author

3 thoughts on “Robocopy: Best practices for working with this helpful Windows utility”

  1. I appreciate your intent but this would be more helpful if it explained how to actually use ‘restart-able mode,’ and explained what “errors” /TIMEFIX and /SECFIX actually fix. Admittedly I am not a programmer.
    Also, when copying between two Win 10 machines over a standard AC class wireless network, how many handles can actually be utilized?
    Some time ago I did some testing and found increasing file handles actually slowed the process by a lot, presumably not being able to manage the overhead—fast processing, fast network, slow storage devices. Thanks for any clarification.

  2. I like Robocopy more than other tools but sometimes it fails and this makes me use a GUI alternative, for example, Duplicate, Carbonite,
    Gs Richcopy360 and Goodsync

Leave a Comment

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

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top