Subscribe to the TST RSS Feed

Robocopy: No, It’s Not a Giant Robot!

ben_headshot_reflection.jpg

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 \\BigServer\ThingFolder \\SmallServer\StuffFolder /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 \\BigServer\ThingFolder \\SmallServer\StuffFolder /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 Vista features with Train Signal’s Windows Vista Training!

windows_vista_training_100x75_1.jpg

  • You get:
  • 19+ hours of instructor led training videos
  • 50+ pages of instructor’s notes in a PDF file
  • Exam coverage for the Configuring Windows Vista (70-620) exam

Learn more and view the free demo here!



 

Related Posts:


 

2 Responses to “Robocopy: No, It’s Not a Giant Robot!”

  • Chris Says:

    Hi Ben,

    Was a bit surprised you didn’t mention Spotlight http://www.microsoft.com/technet/technetmag/issues/2006/11/UtilitySpotlight/ in your piece about Robocopy. But then I do suppose the piece was about Vista. Haven’t seen Robocopy in Vista yet (ain’t seen much of Vista to be honest) but I do hope it has the GUI as well as the command line options. The GUI makes for fast copy setups if you are not familiar with command line. Look forward to another excellent Train Signal masterpiece when I finally get the Vista CBT.

    Regards,

    Chris

  • Abdul Rafeeque Says:

    Hi Ben,

    It is very useful information, wish you all the best

    Regards,
    Abdul Rafeeque

Leave A Comment: