I'd like to use robocopy to copy a tree of binaries to a destination while excluding some subdirectories. Using /XD I was only able to partially achieve what I was looking for.

This excludes the "Tests" subfolder as intended:

robocopy %src% %dst% /MIR /PURGE /XD "Tests"

What I'd like to do is this:

robocopy %src% %dst% /MIR /PURGE /XD "Tests" "Common\Core.Generated" "Client\Core.Generated"

but robocopy seems to ignore this. I could exclude the directories by specifying the full path, but I do not know how to qualify the paths in the batch script I'm writing, as the %src% argument is a relative path.

Another alternative I've found is using a wildcard:

robocopy %src% %dst% /MIR /PURGE /XD "Tests" "*Core.Generated"

This is what I'll be using for now, but it is not quite what the command should do.

link|improve this question

feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.