//View Tip #796
Similar Tips
» Moved Trac and Subversion repositories to another machine/direct
» Duplicate directory tree
» Randomized find
» Rename many files using find and perl
» Directory Tree


Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
Use this command to find files of a given mime-type. For example to find all PNG images in a directory or below:

find . -exec file -i {} \; | grep image/png

View Comments »


Add your comment

Comments are currently disabled
As written this will match directories, pipes, etc. as well as files.  An improvement would be:

find . -type f -exec file -i {} \; | grep image/png
Posted 2009-05-12 10:17:54
You all forgot putting quotes arround:

find . -type f -exec file -i "{}" \; | grep image/png

It's also worth to mention that you can print all images of any type:

find . -type f -exec file -i "{}" \; | grep image/
Posted 2009-05-21 13:47:18

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit