10

I have a txt file with the full path for .jpg files, I need to xcopy the whole folders including everything inside using xcopy using batch file

massaki
  • 759
  • 2
  • 8
  • 15

3 Answers3

18

This is an old question, but I had the same question and neither of the above answers quite did it for me. I had to add /s:

xcopy C:\path\to\source\directory D:\path\to\destination\ /e /i /y /s

That copys all files, subfolders, and files in subfolders. More (and helpful) documentation available here:

https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/xcopy

kampsj
  • 3,139
  • 5
  • 34
  • 56
Michael
  • 356
  • 2
  • 4
  • 12
  • 1
    Updated docs link: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/xcopy – kampsj Mar 13 '18 at 13:38
2

xcopy /? will show you the options you can use. You probably want something like xcopy C:\path\to\source\directory D:\path\to\destination\ /e /i /y

ewall
  • 27,179
  • 15
  • 70
  • 84
1

Something like this should do it

FOR /F "delims=" %%i IN (c:\temp\paths.txt) DO xcopy "%%i*.jpg" "C:\test\" /s /y
Dave
  • 1,062
  • 7
  • 8