Page 1 of 1

Batch code to find a list of filenames in a dir. and copy

Posted: 14 Jan 2014 06:31
by Superdonk
hi guys

I'm not even sure whether this is possible, but...

I have a list of filenames (abcd.pdf, 1234.pdf etc) that i want to search in a directory, which has sub directories to find each of the filenames and copy them to a new folder.

Can you help?!?

TVM

Re: Batch code to find a list of filenames in a dir. and cop

Posted: 14 Jan 2014 07:49
by penpen
Maybe this batch may help you:

Code: Select all

for /F "tokens=* delims=" %%a in ('dir abcd.pdf 1234.pdf /A-D /B /S 2^>nul') do echo copy "%%~a" newTargetFolder
Remove the echo, if this is what you wanted to do.

penpen