Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm using Robocoy to transfer a directory and all it's contents. I use the following command as part of a batch file to copy the directories wile ignoring the images subdirectories.

ROBOCOPY C:\source C:\destination /S /L /XD C:\source\images

Most of the images in C:\source\images\ are in subdirectories, named entirely through digits (eg C:\source\images\101\, C:\source\images\102\ .. C:\source\images\2894\) and I want to continue to exclude all and any of these existing or future numerically named subdirectories. However, there is also a subdirectory of C:\source\images that I would like to include in the robocopy command; C:\source\images\static\. I had thought I could use wildcards to exclude directories beginning with 1*, 2* .. 9* but this does not work with the exclude directory (/XD) option.

My immediate thought for a workaround (after having written this all out!) is to include a second and subsequent robocopy command

ROBOCOPY C:\source C:\destination /S /L /XD C:\source\images
ROBOCOPY C:\source\images\static\ C:\destination\images\static\ /S /L

Is there a better way to do this?

share|improve this question
add comment

1 Answer 1

I suspect sometimes you just have to break a problem up into parts, or change the way you organise the folders :-)

Also, if you start being too fancy with exclusions or inclusions, you might find you are destroying performance anyway.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.