Copy a group of folders but only 1 subfolder


  1. Posts : 2
    Windows 7
       #1

    Copy a group of folders but only 1 subfolder


    I have a large group of 3000 folders and in them, there are the seletion of subfolders as shown below.

    Property 1
    -Gas
    -Electric
    -Asbestos

    Property 2
    -Gas
    -Electric
    -Asbestos

    etc

    I need to create a CD containing all Gas information so I was hoping to find a way of copying the folders so that the root folders, "Property 1", "Property 2" etc are still there but only contain the Gas subfolder.

    The only way I know of is to copy the whole thing somewhere else and delete the subfolders I don't want but I don't have the hard drive space - the above list is a simplified version!

    Many thanks in advance.

    Pete
      My Computer


  2. Posts : 194
    Windows 10 x64
       #2

    Since this is a custom thought process, you'll need to script it.
      My Computer


  3. Posts : 6,285
    Windows 10 Pro X64
       #3

    Are there files in the root directory, i.e. Property 1?

    You can try xcopy, it may do what you need. Something like:

    xcopy "\Property 1\Gas\*.*" "\targetdirectory" /e

    Edit: You could also try robocopy with the /xd <Directory>[ ...] parameter.

    /xd excludes directories that match the specified names and paths. That way you could do a full copy and exclude the sub-directories you don't want.
      My Computer


  4. Posts : 2
    Windows 7
    Thread Starter
       #4

    Robocopy.... awesome! Did the job perfectly. Many thanks!
      My Computer


  5. Posts : 6,285
    Windows 10 Pro X64
       #5

    Great, glad it worked. Thanks for letting me know.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 03:54.
Find Us