Windows 10: Xcopy syntax for multiple source directories

Discus and support Xcopy syntax for multiple source directories in Windows 10 Support to solve the problem; can someone show me a sample xcopy command to copy C:\Directory1 and C:\Directory2 to a destination directory H:\DestinationDirectory? 88324 Discussion in 'Windows 10 Support' started by tcebob, Jul 6, 2017.

  1. tcebob Win User

    Xcopy syntax for multiple source directories


    can someone show me a sample xcopy command to copy C:\Directory1 and C:\Directory2 to a destination directory H:\DestinationDirectory?

    :)
     
    tcebob, Jul 6, 2017
    #1
  2. BulldogXX Win User

    copying folders

    I believe the xcopy command is still included in Windows 10. You can use it with switches to duplicate a folder structure without copying the folders' contents.

    The /t switch copies the folder structure (only) from the source folder to the destination folder without copying the files, but it won't copy empty folders in the source folder. If the source folder includes empty folders you will need to add the /e switch
    as well. So the full syntax would be:

    xcopy source target /t /e

    From the School of Hard Knocks: Practice with a set of dummy folders first.

    Just remember: You need to have adequate permissions in the source and destination folders.
     
    BulldogXX, Jul 6, 2017
    #2
  3. Windows Boot Sector corrupted

    Sorry, unless you post the full xcopy command it is impossible to say what is wrong. Anyway, you should use robocopy.exe instead of xcopy because xcopy will miss lots of files.

    What is the source folder you wish to copy?

    What is the target drive?
     
    Frederik Long, Jul 6, 2017
    #3
  4. Private Win User

    Xcopy syntax for multiple source directories

    try the loop,

    Code: for %%a in ( "C:\Directory1" "C:\Directory2" ) do ( xcopy /s /d "%%~a" "H:\DestinationDirectory" )[/quote]
     
    Private, Jul 6, 2017
    #4
  5. tcebob Win User
    Very good, I will use it.

    In cmd, xcopy help states "source Specifies the file(s) to copy." but does not detail how to list them.

    is the squiggle in %%~a intentional or a typo?
     
    tcebob, Jul 6, 2017
    #5
  6. Private Win User
    the above syntax is to be used in a batch file.

    here's a single liner for cmd:

    Code: for %a in ("C:\Directory1" "C:\Directory2") do (xcopy /s /d "%~a" "H:\DestinationDirectory")[/quote]
    yes, the squiggle is intentional, it's for a short and long pathnames element.
     
    Private, Jul 6, 2017
    #6
  7. tcebob Win User
    Ah, so. Odd, the d/ switch is not listed in cmd help. I changed s/ to e/ because, as a backup, I want a complete image, including empty directories.
     
    tcebob, Jul 6, 2017
    #7
  8. tcebob Win User

    Xcopy syntax for multiple source directories

    Tried and failed. My bad, probably. I cannot find how to include the actual code as you did, and copying directly to this editor removes line feeds.
     
    tcebob, Jul 7, 2017
    #8
  9. Private Win User
    the /d switch is for date. if not specify, only the newer files will be copied.

    You can try the single line syntax above, just double the percent sign (%a to %%a) if you wish to create a batch file.
     
    Private, Jul 9, 2017
    #9
  10. tcebob Win User
    Thanks for your patient help.
    I will mark this as solved

    This is a test of the Code tags:

    Code: Explorer /root, \\server\share, select, Program.exe[/quote] Aha! it worked.
     
    tcebob, Apr 4, 2018
    #10
Thema:

Xcopy syntax for multiple source directories

Loading...
  1. Xcopy syntax for multiple source directories - Similar Threads - Xcopy syntax multiple

  2. Robocopy automatically taking source directory as the script file directory

    in Windows 10 Network and Sharing
    Robocopy automatically taking source directory as the script file directory: Synopsis:- Script file directory name -> PowerShellScripts in Desktop in local C:\...- Script file name -> Dbackup.ps1- Intended source for mirroring -> D:\ a partition on local hard disk- Intended destination for mirroring -> F:\D_LAPTOP_BACKUP_ ... F: is external SSD...
  3. Robocopy automatically taking source directory as the script file directory

    in Windows 10 Gaming
    Robocopy automatically taking source directory as the script file directory: Synopsis:- Script file directory name -> PowerShellScripts in Desktop in local C:\...- Script file name -> Dbackup.ps1- Intended source for mirroring -> D:\ a partition on local hard disk- Intended destination for mirroring -> F:\D_LAPTOP_BACKUP_ ... F: is external SSD...
  4. Robocopy automatically taking source directory as the script file directory

    in Windows 10 Software and Apps
    Robocopy automatically taking source directory as the script file directory: Synopsis:- Script file directory name -> PowerShellScripts in Desktop in local C:\...- Script file name -> Dbackup.ps1- Intended source for mirroring -> D:\ a partition on local hard disk- Intended destination for mirroring -> F:\D_LAPTOP_BACKUP_ ... F: is external SSD...
  5. xcopy directory problem

    in Windows 10 Network and Sharing
    xcopy directory problem: In Windows 10 I open cmd and entered d: mkdir "backup of disk e" cd "backup of disk e" xcopy /e/i/h/c f:/ . everything seemed to work fine. However, the directory does not show in the finder, nor in cmd using dir. If I do dir "backup of disk e" I do get a listing...
  6. Open source tool for directory statistics

    in Windows 10 Ask Insider
    Open source tool for directory statistics: Can anyone suggest a good open source alternative for WinDirStat? I am not having access to install any software, so this should work as a standalone application. submitted by /u/pradpee [link] [comments]...
  7. The filename, directory name, or volume label syntax is incorrect

    in Windows 10 Network and Sharing
    The filename, directory name, or volume label syntax is incorrect: Whenever I boot my computer a pop up appears saying 'The filename, directory name, or volume label syntax is incorrect'. This is the error shown: [ATTACH]...
  8. incorrect xcopy syntax can anyone tell me what i did

    in Windows 10 Backup and Restore
    incorrect xcopy syntax can anyone tell me what i did: instead of using this command xcopy source destination /s i used xcopy /s source destination the source is a folder which wasn't created on the destination. however, the xcopy command ran. i finally stopped the process using cntr c. please tell me what i did [img] 139452
  9. Batch: change target directory date after xcopy

    in Windows 10 Backup and Restore
    Batch: change target directory date after xcopy: I use this command to make a weekly back up my personal files: Code: xcopy C:\all\* Z:\Allbak\* /C /D /E /I /W /Y[/quote] Works fine but how can I change the date attribute of the Allbak directory to the current date? 102611
  10. "The syntax of the file name, directory or volume is not correct."

    in Windows 10 Performance & Maintenance
    "The syntax of the file name, directory or volume is not correct.": In Audit mode, if I run the %SystemRoot%\System32\Cmd.exe /c cleanmgr /sageset:65535 & cleanmgr /sagerun:65535 command from the Command Prompt, the "Disk Cleanup Settings" window is displayed. So, I select all the items and press Ok. Now, before the prompt is displayed...

Users found this page by searching for:

  1. Xcopy multiple directories into multiple destination destination directories

    ,
  2. syntax for listing multiple sources in dos xcopy

    ,
  3. xcopy multiple threads

    ,
  4. using xcopy multiple files from source to target on multiple pc,
  5. xcopy multiple directory copy example,
  6. xcopy copy multiple source