Apps Microsoft

Robocopy exclude director syntax

I am an ardent user of Microsoft’s free command line utility “Robocopy” for copying folders between drives or perform a manual backup of my documents to an external drive. I have been using this for more than a decade now. Over the years the folders that I want to be excluded while copying has increased and I have never bothered to check the parameters. Today I realized I have been inadvertently copying few system folders and a folder named “Microsoft” containing all Tech-Ed & Mix event videos, this happened due to wrong parameters. After few minutes of debugging with /L switch in Robocopy, I realized Robocopy doesn’t like the trailing slash () after each folder path that you want to be excluded, remove the trailing slash and everything works fine. I am giving the command that worked for me as an example, needless to say I have changed the drive names to protect my PC’s privacy.

ROBOCOPY X:\ Y:\DESKTOP /XD “X:\System Volume Information” “X:\WINDOWSIMAGEBACKUP” “X:\MICROSOFT” “X:\TEMP” “X:\$RECYCLE.bin” /MIR /R:2 /W:2