Friday, February 19, 2010

Robocopy loop


Because I didn't invest in Vista I missed out on a lot of the new features it had. I am only finding them out since I switched to Windows 7. One new thing I have learned recently is that the long loved xcopy has been deprecated in favour of the new Robocopy. This is great news for techs like me who often have to backup up unbootable machines before reformatting them.

One recent problem I encountered while using robocopy has to to with directory junctions. I had booted a Vista machine with a Microsoft's desktop recovery disk and I wanted to backup the user's folder from the 'users' directory. Every time I tried to do this with Robocopy I ended up with a loop in the 'AppData folder '. At this point in the copy process Robocopy made continuous nested directories of 'AppData'.

The problem is that there is a junction in this directory and I had not used the switch to exclude junctions in directories. That's the /XJD switch. When i got all that figured out I recieved an 'access denied' message in vertain files. This was relieved by using the '/B' switch to run Robocopy in 'backup' mode.

The last switch I had to use was '/Z' switch which runs the command in 'restartable' mode. I suggest using this when the destination directory is somewhere in a network location. This all took some time because Robocopy is far from verbose with it's error messages.

So the final command was robocopy source destination /E /S /XJD /B /Z
Don't forget that path names with space still need to be between quotes. Happy Robo-copying!

No comments: