Q:

Batch Copy Script recursive

i have the following piece of code, to copy files to my usb drive silently:
@echo off 
:: variables 
/min 
SET odrive=%odrive:~0,2% 
set backupcmd=xcopy /s /c /d /e /h /i /r /y 
echo off 
%backupcmd% "C:\*.pdf" "%drive%\all\"
@echo off 
cls

I want to extend this, to copy all pdf files in the folder structure c:\ recursive.
Any suggestions?
Also i want to use some patterns like *test.pdf, test*.pdf.
Maybe regex would be the right way, but i dont know how to do..
Thx for your support! :) Windows isnt my friend .. :-/

A:

I'm not entirely sure what you are trying to do, but if you want to copy all the pdf files from C:\ and below then this should do it
for /r C:\ %%x in (*.pdf) do xcopy %%x "%drive%\all"

