I wanted a way of backing up my source code edits in near-real-time to a network share. There are plenty of file-sync tools around, but I decided to use Microsoft’s free Robocopy utility.
Here’s the command-line I’m using:
robocopy c:\src u:\src_mirror /S /MON:1 /XA:R /XD bin obj debug release build /XF *.ncb *.scc *.user *.webinfo *.suo /R:5 /W:1
The interesting switches are /MON:1, which tells Robocopy to check my source directory for changes once a minute, and /XA:R, which tells it to ignore readonly files. Because of the /XA:R, files checked into Sourcesafe are ignored. Conversely, any files I check-out become read/write and automatically get mirrored.
Obviously there are some non-readonly files and directories I don’t want to mirror, hence the /XF and /XD switches.
Been using this for a few days, and so far it seems to work great.