0

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?

fearoffours
  • 101
  • 3

1 Answers1

2

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.

DutchUncle
  • 1,265
  • 8
  • 16