Just want to ask, can you copy one entire directory to multiple destination?
Example
Source: "c:\MyProject\Sample\*.*"
Destination: "\\Computer1\Sample\"
"\\Computer2\Sample\"
"\\Computer3\Sample\"
"\\Computer4\Sample\"
I used this syntax to copy the entire directory
Example
Xcopy /E /Y "c:\MyProject\Sample*.*" "\Computer1\Sample\"
Now, Is there a way to loop through the following destination..? Do you have any suggestion on i can accomplish this scenario..?
Hope to hear from you soon..
Thanks,
Link
for %%D in (
"\\Computer1\Sample\"
"\\Computer2\Sample\"
"\\Computer3\Sample\"
"\\Computer4\Sample\"
) do Xcopy /E /Y "c:\MyProject\Sample*.*" "%%D"
The above assumes you are using a batch file. If run from the command line, then use %D
instead of %%D
. Also, the entire command can be put on one line, with spaces as path delimiters.
You can write a batch file that has multiple xcopies to achieve this
Xcopy /E /Y "c:\MyProject\Sample*.*" "\Computer1\Sample\"
Xcopy /E /Y "c:\MyProject\Sample*.*" "\Computer2\Sample\"
Xcopy /E /Y "c:\MyProject\Sample*.*" "\Computer3\Sample\"
Xcopy /E /Y "c:\MyProject\Sample*.*" "\Computer4\Sample\"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With