Page 1 of 1

Copy files from text list?

Posted: 27 May 2011 08:28
by akira71
Does anyone know if it is possible to create a batch file that will use xcopy but only search in a given set of directories, and all levels below it, as specified in a text file (i.e. the list could be updated without having to recode the .bat file)?

In case this isn't clear, the text file might look like:
c:\test\
c:\test1\
c:\test2\

Just checking!

Thanks =)

Re: Copy files from text list?

Posted: 27 May 2011 08:47
by orange_batch
Something like...

Code: Select all

set "destination=C:\whereever"
for /f "tokens=*" %%x in (folders.txt) do xcopy "%%x" "%destination%"

Set your own xcopy switches. xcopy /?