user2434611
user2434611

Reputation: 135

how to copy multiple files to a folder using xcopy

would you please let me kno how can I copy multiple directories located in different locations to a backup directoy

sources(directories) are D:\share\t1 , D:\new\t3 , C:\media\t4 F:\save\bank destination directory is C:\shared\backup

thanks in advance

Upvotes: 8

Views: 20267

Answers (2)

Endoro
Endoro

Reputation: 37569

Why not a for loop? I love it and it is the best fit for this arcane question:

 For %%a in (
 "D:\share\t1"
 "D:\new\t3"
 "C:\media\t4"
 "F:\save\bank"
  ) do (
xcopy /s /d "%%~a" "c:\shared\backup"
  )

Upvotes: 7

Matt Williamson
Matt Williamson

Reputation: 7095

You can use a for loop to do this.

Try:

 For %%a in (D:\share\t1,D:\new\t3,C:\media\t4,F:\save\bank) do xcopy %%a c:\shared\backup

Upvotes: 0

Related Questions