New
#1
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?
can someone show me a sample xcopy command to copy C:\Directory1 and C:\Directory2 to a destination directory H:\DestinationDirectory?
try the loop,
Code:for %%a in ( "C:\Directory1" "C:\Directory2" ) do ( xcopy /s /d "%%~a" "H:\DestinationDirectory" )
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?
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")
yes, the squiggle is intentional, it's for a short and long pathnames element.
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.
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.
Thanks for your patient help.
I will mark this as solved
This is a test of the Code tags:
Aha! it worked.Code:Explorer /root, \\server\share, select, Program.exe