0

I have two sub-folders in my main folder in source, from those two sub-folders I wanted to copy only one folder to destination.

And I have many main folders like that, wanted to apply same logic to all main folders. Please help me with the appropriate command for this.

Source:

  ABC
        123
        456
  XYZ
        123
        456

Destination:

ABC
      123     (to be copied)
XYZ
      123      (to be copied)

(‘456’ folder should exclude)

migrated from serverfault.com Jul 6 '17 at 6:19

This question came from our site for system and network administrators.

  • You appear to have six directory names there, several of which are duplicates. Is that in some structure, e.g. with the numeric folders as sub-folders within the lettered ones? – Pak Jun 22 '17 at 5:32
  • This probably shouldn't have been migrated. As for the question itself, just define all 456 folders as exclusions. – Seth Jul 6 '17 at 6:23
  • This question is unclear. Are you looking to not copy any folder with a certain name, or only if it's the first child? Or do you only want folder 123 when it's the child folder – Dave Jul 6 '17 at 6:37
1

Use robocopy's xd parameter to exclude folders; e.g. robocopy source_folder destination_folder /xd 456

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.