Saturday, May 02, 2009

Using robocopy on Vista

For a while I've been using robocopy as my Windows backup utility. It's included in Vista, and you can download it for other versions as part of the Windows 2003 server resource kit. It has oodles of command line parameters, and I have it set up so that it copies files incrementally from my local disk to an external one, and also deletes files from the external disk they were copied on a previous occasion but have now been deleted from the local disk. The command line I used was this:

robocopy "c:\Documents and Settings" "e:\Backup\David\Documents and Settings" /R:0 /W:0 /MIR /PURGE /TEE /LOG+:e:\David.log /XD "Temporary Internet Files"

On Vista, I first tried this:

robocopy c:\Users\David %CD%\Backup\David\David /R:0 /W:0 /MIR /PURGE /TEE /LOG:%CD%\David.log

(This is run from the root of the external disk, hence the %CD%).
It doesn't quite work. It creates a deeper and deeper recursive tree for AppData. I think this is because there are some hidden shortcuts and symbolic links. You also get duplicate copies of some files under the Vista Documents folder, which has a secret shortcut from My Documents. So I now use:

robocopy c:\Users\David %CD%\Backup\David\David /R:0 /W:0 /MIR /PURGE /TEE /LOG:%CD%\David.log /SL /XJ /XA:ST

and this seems to do better. /SL doesn't follow symlinks (like tar), /XJ excludes join points (probably not needed). Critically /XA:ST doesn't backup system or temporary files, which seems to be the cause of most of the problems.

No comments: