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.
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
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
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
FREE SERVICE: Get tips like this every week in WindowsTips, a free productivity newsletter. Enter your address and click "Subscribe."