//View Tip #796
Similar Tips
» Random mass-rename
» Checksum directory recursively
» Replace expr by other recursively
» Pipe files to an archive
» Find last modified files on a filesystem

 

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

CAPTCHA

No HTML allowed. URLs will be linked with nofollow attribute. Whitespace is preserved.

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