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

Page 1 of 2 12 LastLast

  1. Posts : 37
    Windows 10 Enterprise
       #1

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


    Hello, 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. Thank you
      My Computer


  2. Posts : 17,661
    Windows 10 Pro
       #2

    This command would copy the folder structure of C:\Downloads to X:\Downloads. In other words, only the folder hierarchy, the folders would be copied, not the files in folders:

    xcopy C:\Downloads\*.* X:\Downloads /t

    It copies the whole folder hierarchy, you cannot just select the top level folders. However, it's then an easy task to open each folder on target and delete all subfolders.

    Kari
      My Computer


  3. Posts : 37
    Windows 10 Enterprise
    Thread Starter
       #3

    how come it doesn't copy the "Downloads" folder itself ? can /lev:1 command be used to copy just the Downloads folder ? By the way, I am using xxcopy not xcopy
      My Computer


  4. Posts : 17,661
    Windows 10 Pro
       #4

    ghostanime2001 said:
    By the way, I am using xxcopy not xcopy
    I apologize for not noticing the double x in the command name. That being said:

    I am a Windows purist, only using original, native Windows tools. I have absolutely no interest, no need, I repeat: no interest in these obscure third party tools.

    Can't help you.

    Kari
      My Computer


  5. Posts : 9,789
    Mac OS Catalina
       #5

    Kari said:
    I apologize for not noticing the double x in the command name. That being said:

    I am a Windows purist, only using original, native Windows tools. I have absolutely no interest, no need, I repeat: no interest in these obscure third party tools.

    Can't help you.

    Kari
    Especially that xxcopy has become abandonware. Robocopy is a better way than xcopy in performing the same thing. https://docs.microsoft.com/en-us/win...mands/robocopy
      My Computer


  6. Posts : 456
    Windows 10
       #6

    Sorry if I misunderstud you but from what I got you only want to create a folder called downloads in e: right?

    md E:\downloads


    P.S: I rechecked your post and came to the conclusion that you want to copy the downloads folder in c: + first level of directories inside downloads but no files or sobfolders besides 1st level.

    robocopy c:\downloads e:\downloads /e /nocopy /lev:2

    lev:1 would copy the downloads folder only and lev:2 copys the first level inside downloads...
      My Computer


  7. Posts : 4,187
    Windows 11 Pro, 22H2
       #7

    ghostanime2001,

    Robocopy is well worth the time to get familiar with. I work minor miracles with it all the time .

    One tip: If you add a "/L" to your command line, it will simulate a run of the command but not actually copying, moving, or deleting anything. It's a great way to experiment and do a "what would happen if I ran this command?".
      My Computers


  8. Posts : 37
    Windows 10 Enterprise
    Thread Starter
       #8

    ricardobohner said:
    P.S: I rechecked your post and came to the conclusion that you want to copy the downloads folder in c: + first level of directories inside downloads but no files or sobfolders besides 1st level.

    robocopy c:\downloads e:\downloads /e /nocopy /lev:2

    lev:1 would copy the downloads folder only and lev:2 copys the first level inside downloads...
    yes that is correct. Im just wondering why there is an exclusion switch (/EX) but there is nothing comparable to include switch.

    For example, if i have 75 folders in C drive and I only want to copy "C:\Downloads" including the downloads parent folder, nothing inside the Downloads folder while also copying the date/time stamp of the downloads folder to the E drive. How can robocopy acheive this ? I have tried.. but I had to resort to xxcopy because it is more in dept that's why I didnt use robocopy. I tried to use xxcopy but IT ALSO only has exclusion specifier for 1 folder at a time. I want something like Include this folder, EXCEPT ALL OTHERS. Or equivalently, Exclude all other folders except THIS folder etc...
      My Computer


  9. Posts : 456
    Windows 10
       #9

    Robocopy is way more advanced than xcopy and you can do much more with it.

    By default robocopy copies the "Data, Atributes & Timestamp" but you can control this with the /copy switch:

    /copyATSOU -> This means copying everyting
    /copyall -> Also copies everthing

    D= Data
    A= Atributes
    T= Timestamp
    S= NTFS Security
    O= File Owner
    U= aUditing Information

    To include only one folder. Let's sey you cant to copy only the Windows folder to D:

    robocopy c: d: Windows /e

    Let's say you want to copy only txt and docx documents form c:\downloads to e:\downloads

    robocopy c:\downloads e:\downloads *.txt *.docx /s

    By default robocopy includes all the files but if you specify files it only copies the specified files.

    Let's say you want to copy all files except for txt and docx files

    robocopy c:\downloads e:\downloads /xf *.txt *.docx /s

    Let's say you want to copy everything except txt and docx files and folders called Windows config and settings:

    robocopy c:\downloads e:\downloads /xf *.txt *.docx /xd Windows config settings

    xf -> exclude files
    xd -> exclude directories

    /e - doesn't stand for exclusion but it means include directory structure including Empty directories /s include folder structure except empty directories.
      My Computer


  10. Posts : 37
    Windows 10 Enterprise
    Thread Starter
       #10

    I do understand that part. But, what if i want to exclude 74 folders, I cannot write 73 folder paths just to include 1 folder to be copied. Hence, why I insisted on using xxcopy NOT XCOPY
      My Computer


 

  Related Discussions
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 03:11.
Find Us




Windows 10 Forums