Skip to content
Advertisement

List all graphic image files with find? [closed]

There are many types of graphic images in this huge archive such as .jpg, .gif, .png, etc. I don’t know all the types. Is there a way with ‘find’ to be able to have it list all the graphic images regardless of their dot extension name? Thanks!

Advertisement

Answer

This should do the trick

find . -name '*' -exec file {} ; | grep -o -P '^.+: w+ image'

example output:

./navigation/doc/Sphärische_Trigonometrie-Dateien/bfc9bd9372f650fd158992cf5948debe.png: PNG image
./navigation/doc/Sphärische_Trigonometrie-Dateien/6564ce3c5b95ded313b84fa918b32776.png: PNG image
./navigation/doc/subr_1.jpe: JPEG image
./navigation/doc/Astroanalytisch-Dateien/Gamma.gif: GIF image
./navigation/doc/Astroanalytisch-Dateien/deltaS.jpg: JPEG image
./navigation/doc/Astroanalytisch-Dateien/GammaBau.jpg: JPEG image
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement