copying only specific files from nested folder structure

Hi Folks-

I’m trying to move only PDFs from a heavily nested folder structure (ie remove the subfolders). Applescript times out on a large folder, so I thought I’d use the line command:


find /Volumes/Old_Archive/08_Short_Search/133013_fnl/*.pdf -print | xargs mv {} /Volumes/_target

and many variants- using ditto, cp… and I’m not having any luck…

thanks,

Ralph

.or the spotlight version


set sourceFolder to quoted form of "/Volumes/Old_Archive/08_Short_Search/133013_fnl/"
do shell script "/usr/bin/mdfind -onlyin " & sourceFolder & " -0 " & "'kMDItemKind  = \"*PDF*\"'" & " | /usr/bin/xargs -0 -J {} mv {} /Volumes/_target"

Jaques- by monkey-on-the-keyboard happenstance I actually got the -exec version to work just before i got your response! The trick was putting the path in ’ ’ (soft quotes). Thanks for the xargs version as well.

Stefan- thanks for the mdfind version. I’m using that utility more and more. The only issue I’ve had is that network servers tend to yield spotty metadata.

-Ralph