//View Tip #796
Similar Tips
» Mass-renaming files
» Remove empty directories
» Find and replace on specific files
» Replace expr by other recursively
» Find and Grep

 

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 »




Comments 

Add your comment

Comments are currently disabled
SndChaser
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
Vincent
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