Reputation: 3
Hi I am looking for a (simple) batch script for Windows XP to copy pdf files with different filenames but having the same reference numbers in their filenames to a specific folder in a different drive.
E.g.
Copy all pdf's with reference number 111 to folder "test"
Source files in F drive
F:\folder 1\filename 1_111.pdf
F:\folder 1\folder 2\filename 2_111.pdf
Destination folder in C drive
C:\test\
I am a novice, so thank you in advance for your help.
Regards, Olive
Upvotes: 0
Views: 7206
Reputation: 41224
This is another option:
@echo off
for /f "delims=" %%a in ('xcopy /l /e /y "F:\folder 1\*111*.pdf" "c:\test\" ^|find ":"') do copy "%%a" "c:\test"
Upvotes: 1