Using Robocopy to Mirror Directories

by Barry Dysert
(last updated August 11, 2014)

Robocopy is the tool to use when working with entire directories, since that's what it was designed to do. Let's say you want to "mirror" directories, i.e., make two directory trees contain identical files/folders. This is similar to using the /E switch (which is covered under the tip titled "Using Robocopy to Copy Entire Directories") along with the /PURGE switch. (The /PURGE switch tells Robocopy to delete destination files/folders that no longer exist in source.) The shorthand switch to mirror directories is /MIR, so the command to mirror directories is:

C:\> ROBOCOPY C:\Temp1 C:\Temp3 /MIR

This results in the creation of C:\Temp3, and all of the files and folders under C:\Temp1 will be copied to the newly built tree under C:\Temp3. In addition, if C:\Temp3 already existed, any files in its tree that are not in the C:\Temp1 tree will be deleted from the C:\Temp3 tree.

 This tip (13197) applies to Windows 7 and 8.

Author Bio

Barry Dysert

Barry has been a computer professional for over 30 years, working in different positions such as technical team leader, project manager, and software developer.  He is currently a senior software engineer with an emphasis on developing custom applications under Microsoft Windows. ...

MORE FROM BARRY

Changing the Default Program for a File

Files are opened by programs depending upon the file's type. If you want to change this association so that a different ...

Discover More

Changing the Size of the Taskbar

The Taskbar is the "heart" of managing your work in Windows. Fortunately, it can be sized to your heart's content. This tip ...

Discover More

Understanding Windows Slide Show

If you have folders containing pictures, you may want to display them in a slide show. This tip explains how to do it.

Discover More
More WindowsTips

Configuring Windows to Do Backups on a Schedule

Performing regular backups of your system offers you peace of mind because you don't have to worry about data loss in the ...

Discover More

Using Robocopy to Copy Entire Directories

It's simple to use Robocopy to copy entire directories. Dealing with directories is what it does best! This tip shows you how ...

Discover More

Renaming Multiple Files

Got a bunch of files you need renamed? Windows can help you out, but only in a limited manner. This tip shows you how.

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WindowsTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 9 + 4?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in WindowsTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.