Robocopy? Copy Directory Structure 1 level


  1. Posts : 9
    Windows 7 Pro x64
       #1

    Robocopy? Copy Directory Structure 1 level


    I want copy a list of folders (a few hundred) to a new location. I tried using robocopy but can only get it to either copy the selected folder or all folders with subfolders. What I want is to only copy one level of folders and not the subfolders within.
    Example:
    C: Drive (the source)
    ->Clients
    ->Client 1
    ->Order1
    ->More SubFolders
    ->Order2
    ->Order3
    ->Order4
    ->Client 2
    ->Order1
    ->Order2
    ->Order3
    ->Order4
    ->Client 3
    ->Client 4
    So I would want to copy over just the first level of folders (the list of clients), but none of the subfolders within each client folder.

    any help would be great.
    thanks.
      My Computer


  2. Posts : 19,383
    Windows 10 Pro x64 ; Xubuntu x64
       #2

    Hi,

    Try using the /LEV:n switch in your robocopy command.

    From robocopy /? at command prompt
    Code:
    ::
    :: Copy options :
    ::
                     /S :: copy Subdirectories, but not empty ones.
                     /E :: copy subdirectories, including Empty ones.
                 /LEV:n :: only copy the top n LEVels of the source directory tree.
    It should look similar to this:

    Code:
    robocopy C:\Clients G:\Backup\Clients /LEV:2
    Perform some tests to make sure it works OK.

    Regards,
    Golden
      My Computer


  3. Posts : 9
    Windows 7 Pro x64
    Thread Starter
       #3

    Perfect!
    I used
    robocopy "C:\Clients" "D:\Clients" /e /LEV:2 /XF "*.*"
    without the "/xf [filname]" it was copying over all files as well, I just wanted the folders.
    Thanks again!
      My Computer


  4. Posts : 19,383
    Windows 10 Pro x64 ; Xubuntu x64
       #4

    No worries. Glad it worked OK for you.
      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 17:14.
Find Us