Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xcopy all folders and subfolders from txt(with paths , and spaces )

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

like image 675
massaki Avatar asked Jul 22 '11 14:07

massaki


3 Answers

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://docs.microsoft.com/en-us/windows-server/administration/windows-commands/xcopy

like image 70
Michael Avatar answered Nov 15 '22 19:11

Michael


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

like image 21
ewall Avatar answered Nov 15 '22 18:11

ewall


Something like this should do it

FOR /F "delims=" %%i IN (c:\temp\paths.txt) DO xcopy "%%i*.jpg" "C:\test\" /s /y
like image 37
Dave Avatar answered Nov 15 '22 19:11

Dave