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

3

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

Education answered 22/7, 2011 at 14:27 Comment(1)
you have got a list of files. Which folders you want to copy? give an example.Selfsown
D
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

Dimpledimwit answered 8/7, 2016 at 18:43 Comment(1)
Updated docs link: learn.microsoft.com/en-us/windows-server/administration/…Watermelon
R
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

Rosalbarosalee answered 15/8, 2011 at 19:24 Comment(0)
D
1

Something like this should do it

FOR /F "delims=" %%i IN (c:\temp\paths.txt) DO xcopy "%%i*.jpg" "C:\test\" /s /y
Drink answered 25/7, 2011 at 15:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.