Pages

Showing posts with label ThingsIReallyShouldKnow. Show all posts
Showing posts with label ThingsIReallyShouldKnow. Show all posts

Friday, 19 March 2010

RoboCopy Terminates XCopy!

I've just been adding some more automation sprinkles to our website deployment strategy. I now have 12 white-labelled sites that need publishing at least once a day. Now, I know there'll be some fully automated solutions out there but, hey, this works for us.

I was building a little batch file to deploy the extracted files once cited on the server. OK, so let's re-acquaint myself with XCopy's parameters.

"Note: Xcopy is now deprecated, please use Robocopy."

WTF. What's Robocopy!?

Seems as though I've missed a few of the Microsoft emails about this 'new' feature of Windows. It used to be available as a Resource download but is a standard component from Windows XP onwards.

So, what can it do? Well, after a cursory glance, pretty much anything. There's a glut of parameters covering the following sections: Copy, File Selection, Retry, Logging, Job. Here's a couple that stood out as extremely useful...

  • /E :: copy subdirectories, including Empty ones.
  • /LEV:n :: only copy the top n LEVels of the source directory tree.
  • /Z :: copy files in restartable mode (if the connection is interrupted it will continue when next available!).
  • /PURGE :: delete dest files/dirs that no longer exist in the source.
  • /MIR :: MIRror a directory tree (equivalent to /E plus /PURGE

I'm well aware that I may very well be the only guy on this sphere who isn't aware of this command line tool; but I think this was worth noting anyway.