2012-10-25

Recursively copy all PDF files from a directory tree to a single directory

Someone gave me a bunch of PDF files spread out through multiple subdirectories and I needed to get them all into a single directory.

In Mac OS X (and probably Linux) this will scan through the directory specified and its subdirectories and copy all of the PDF files to the target directory:

find /Users/joedokes/Desktop/source_directory -name "*.pdf" -exec cp {} /Users/joedokes/Desktop/target_directory \;