by Barry Dysert
(last updated October 9, 2017)
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, 8, and 10.
Doing a one-time create of a system repair disk can be worth its weight in gold if you find yourself unable to boot your ...Discover More
Robocopy is a robust file copy utility built into Windows. If you have a lot of file management to do that can't easily ...Discover More
Renaming a large set of files one file at a time can be time consuming and tedious. Windows allows for you to quickly ...Discover More
FREE SERVICE: Get tips like this every week in WindowsTips, a free productivity newsletter. Enter your address and click "Subscribe."