Find JPG Files in Directory and CP (copy) to another directory

Find JPG Files in Directory and CP (copy) to another directory

Hold on Cowboy

This blog post is pretty old. Be careful with the information you find in here. It's likely dead, dying, or wildly inaccurate.

Today I was faced with the challenge of finding all the JPG files in a directory (and subdirectories of that) and copying them to another directory (striping out the subdirectory folder name).

find /path/to/directory/ -iname "*.jpg" -exec cp '{}' /path/to/dest/dir/ \;

That did it perfectly.

Keywords Find Folder Strip Path Copy cp directory

Reference: http://www.linuxquestions.org/questions/linux-newbie-8/shell-script-to-search-and-copy-jpg-to-another-folder.-730320/