If you’ve a large piece of un-branched code you’re working on but you can’t check in to source control then you’ll be worried about losing your changes. You need a backup. Here’s a way of mirroring your working copy.
Robocopy came as part of the Windows Server 2003 Resource Kit Tools. Robocopy can perform mirrors of any directory tree and can monitor that tree for changes, mirroring only the changed files. I’ve set up mine as a scheduled task (Run: robocopy /JOB:SVNBACKUP) (cf: Managed File Transfer, RoboCopy, Sheduled Tasks). A useful Microsoft Robocopy GUI for learning the Robocopy switches is available. When you first create the destination directory with robocopy use the /CREATE switch (see the Robocopy Help file) to minimise directory fragmentation.

The following is my current job file:
:: Source Directory :
/SD:C:\svn\ :: Source Directory.
:: Destination Directory :
/DD:G:\svn\ :: Destination Directory.
:: Exclude These Directories :
/XD :: eXclude Directories matching these names
:: Copy options :
/S :: copy Subdirectories, but not empty ones.
/E :: copy subdirectories, including Empty ones.
/MON:1 :: MONitor source; run again when more than n changes seen.
/MOT:5 :: MOnitor source; run again in m minutes Time, if changed.
/PURGE :: delete dest files/dirs that no longer exist in source.
/MIR :: MIRror a directory tree (equivalent to /E plus /PURGE).
:: Retry Options :
/R:10 :: number of Retries on failed copies: default 1 million.
/W:30 :: Wait time between retries: default is 30 seconds.
:: Logging Options :
/V :: produce Verbose output, showing skipped files.
/NDL :: No Directory List - don't log directory names.
/NFL :: No File List - don't log file names.
/NP :: No Progress - don't display % copied.
/LOG+:C:\Documents and Settings\Placeholder\Application Data\Microsoft Robocopy GUI\Logs\robocopy.log :: output status to LOG file (append to existing log).
/TEE :: output to console window, as well as the log file.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s