How to copy 1st level directories C:\ as source using xxcopy

Page 2 of 2 FirstFirst 12
  1.    #11

    Run 2 robocopy commands. The first to copy just the level 2 folders without subdirectories or contents, and then one more to copy just the one folder out of the 74 that you want to copy.

    If you place them in a batch file then you only need to run the one command (the batch file) manually.
      My ComputerSystem Spec


  2. Posts : 6
    windows 10 education x64
    Thread Starter
       #12

    hsehestedt said: View Post
    Run 2 robocopy commands. The first to copy just the level 2 folders without subdirectories or contents, and then one more to copy just the one folder out of the 74 that you want to copy.
    but if i do level 2 copy... that is the subdirectories level inside C:\Downloads
      My ComputerSystem Spec

  3.    #13

    I'm still not 100% sure on what the exact goal is, so the exact command I provided may not be quite right in your circumstance.

    The way it is worded confuses me.

    I want to know how to copy 1st level directories within the C:\ drive to another external hard drive. More Specifically, I just want to copy the "C:\Downloads" folder into "E:". I do not want any subdirectories or files to be copied, just folders.
    So assuming you have the following as an example:

    Code:
    C:\
       Downloads
          File1
          FolderA
       Folder1
          File2
       Folder2
          File3
          FolderC
       File4
    So what in this structure what do you want to copy and to where? You say that you want to copy just C:\Downloads to E:. You do not want to copy subdirectories or files. Does this mean that you do not want to copy subdirectories or folders OTHER than those in C:\Downloads or do you also not want to copy files and subdirectories with C:\Downloads? Also, to where on E: do you want to copy? To E:\?

    Feel free to include an directory listing with explanation if that is easier.

    I hope that you understand - in order to give a precise command(s), I need precise data to work with.
      My ComputerSystem Spec


  4. Posts : 6
    windows 10 education x64
    Thread Starter
       #14

    more specifically, my question is I want to copy C:\Downloads folder into E:\ so that the folder structure will be: E:\Downloads. I just want to copy 1st level folders inside C:\Downloads; no files within C:\Downloads folder or 2nd level folders ex. C:\Downloads\subdirectory1...2...3..etc..

    What really bugs me is that robocopy has a command to exclude 1 folder. But it doesn't have exclude ALL folders except a given set of folders.. in other words EXCLUDE ALL but a few folders or alternatively, include only a select set of folders

    Click image for larger version. 

Name:	image.png 
Views:	3 
Size:	177.1 KB 
ID:	235211
      My ComputerSystem Spec

  5.    #15

    Ah, yes. I understand.

    The closest thing that I could think of to being able to exclude all folders except a select list of folders, is to do something like the following:

    Output a directory listing of folders to a text file.

    For example:

    Code:
    C:\>dir /A:D /B > D:\MyFolderList.txt
    When I look in the file I see this:

    Code:
    $Recycle.Bin
    $WINDOWS.~BT
    $Windows.~WS
    Documents and Settings
    ESD
    Intel
    MountPoints
    New folder
    PerfLogs
    Program Files
    Program Files (x86)
    ProgramData
    Recovery
    swsetup
    System Volume Information
    usbcreate
    Users
    Windows
    Code:
    /A:D
    tells dir to only list directories. The /B puts out the list in a bare format.

    So now you have a list of folders that you exclude by pasting them into a job file. Simply delete the folder names that you still want to copy.

    Create a job file that includes a list of the folders to be excluded like this:


    Code:
    ::
    :: Exclude These Directories :
    ::
    	/XD		:: eXclude Directories matching these names
    $Recycle.Bin
    $WINDOWS.~BT
    $Windows.~WS
    Program Files
    Program Files (x86)
    ProgramData
    Recovery
    System Volume Information
    TIP: To create a job file do this:

    Create a test file to hold the job. For example, let's say I create a file called E:RoboJob.rcj. Make sure to include the .rcj extension.

    Now, run a robocopy job that might be similar to what you want to do. or example:

    Code:
    robocopy c:\Source D:\Destination /mir /xd ExcludedFolder /save:E:\RoboJob /L
    Note that I have a /L so no action will be taken, but a job file will be created. Note also that I omitted the extension because robocopy will add the .rcj extension.

    Now, modify the job file to add a list of folders to excluse as shown in the lines I noted above.

    To run the command with the job rather than a /save use a /job:RoboJob command like this:

    Code:
    robocopy /job:Robojob /L
    (or omit the /L to actually execute the job).

    So yes, robocopy is not perfect. There are times need to get creative and multiple commands, or you can execute more complex logic by calling it from a batch file using things like a for loop or other logic.

    I hope that this helps!
      My ComputerSystem Spec


 
Page 2 of 2 FirstFirst 12

Related Threads
Hi. I am hoping someone knows a cmd string that will allow me to copy a desktop folder and its subfolders, or at least the files within, to an external drive on a laptop that crashed with what looks like a bad mother board and it will no longer...
hello! for some reason, after doing some successful folder copies (ie no errors) from my external USB drive to my RAID 1 NAS, the contents of some source folders and their respective destination folders do not match in windows explorer, ie...
can someone show me a sample xcopy command to copy C:\Directory1 and C:\Directory2 to a destination directory H:\DestinationDirectory?
Windows 10 and DVD directories in General Support
I have an issue I can't seem to find decent info about. My Win 10 laptop won't see files and folders on DVDs I burned on another box unless I make an ISO on the Win 7 machine first, and then copy it over to the Win 10 machine and "mount" the ISO. ...
Merge Directories in General Support
I have two large Directories (about 25 GB each, 6-7000 files) that contain similar information. One may have newer files than the other. I would like to merge them into one Directory and eliminate duplicate files. Is there some software that...
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 06:39.
Find Us