//View Tip #796
Similar Tips
» Find files by modified time
» Find last modified files on a filesystem
» Directories and its size
» Remove empty directories
» Find and replace on specific files


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