Robocopy: No, It’s Not a Giant Robot!
Robocopy is a nifty little tool that’s been around for a while under the Windows Resource Kit, but Uncle Bill and the gang over at Microsoft have decided that its time has come. Robocopy makes its desktop debut in Vista!
So many of us admins love to pick up another scripting option, and Robocopy is a welcome addition to our Vista toolbox. Okay, sure, it copies stuff, but how it copies stuff is a different story. It only copies whole folders, not individual files. Think of it more like a “smart” copy utility. It has over 80 different switches that automate copying tasks.
Let’s take a look at some of the more popular ones:
Example # 1: /MIR and /Z
- robocopy \BigServerThingFolder \SmallServerStuffFolder /MIR /Z
This command copies the contents of ThingFolder on BigServer to StuffFolder on SmallServer. The /MIR deletes any other file in StuffFolder that doesn’t have a corresponding match in ThingFolder. The /Z option will copy the files in restartable mode, which will resume the copy operation if the network freaks out and kills the copy operation for some weird reason.
Simple stuff, eh? Wrap that sucker into a batch script and you’ve got a simple backup strategy for an important folder.
Example # 2: /COPYALL
- robocopy \BigServerThingFolder \SmallServerStuffFolder /S /COPYALL
Once again, everything in ThingFolder is going to StuffFolder, but this time, the /S switch copies subdirectories unless they’re empty. The /COPYALL switch grabs the original NTFS permissions as well, so you don’t have to wrestle inheritance if there’s a conflict.
Other command line switches include:
- /S – which copies subdirectories, but only if they’re not empty
- /E – which copies subdirectories, even if they’re empty
- /MOV – used to move files, removing them from the source folder
Robocopy is Your Smart and Helpful Friend
Robocopy is also extremely reliable, flexible, and very robust. For example, in case of a network outage, copying is resumed where it was previously cut off without any problems. So if you find yourself halfway through a 4GB file and your network goes down all is not lost! Robocopy is smart enough to wait until the network connection is restored to copy the rest of the file. How cool is that?
Here are some more examples of what Robocopy can do:
- Copy large numbers of files
- Copy entire subdirectories
- Copy attributes, owner information, alternate data streams, auditing information, and more all by default
- Copy NTFS access control list
With 80 different nifty neat-o switches, Robocopy is sure to become one of your favorite robotic assistants! Learn more about Robocopy and other nifty tools and features in our Windows Vista Training.