Copy files from text list?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
akira71
Posts: 3
Joined: 24 May 2011 14:13
Location: Edinburgh, Scotland

Copy files from text list?

#1 Post by akira71 » 27 May 2011 08:28

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 =)

orange_batch
Expert
Posts: 442
Joined: 01 Aug 2010 17:13
Location: Canadian Pacific
Contact:

Re: Copy files from text list?

#2 Post by orange_batch » 27 May 2011 08:47

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 /?

Post Reply