How to find files recursively by file type and copy them to a directory? How to find files recursively by file type and copy them to a directory? bash bash

How to find files recursively by file type and copy them to a directory?


Try this:

find . -name "*.pdf" -type f -exec cp {} ./pdfsfolder \;


Paul Dardeau answer is perfect, the only thing is, what if all the files inside those folders are not PDF files and you want to grab it all no matter the extension. Well just change it to

find . -name "*.*" -type f -exec cp {} ./pdfsfolder \;

Just to sum up!


Something like this should work.

ssh user@ip.addr 'find -type f -name "*.pdf" -exec cp {} ./pdfsfolder \;'