Main Menu

Filtering Only Image Files

Started by aussieboykie, June 18, 2020, 08:59:08 PM

Previous topic - Next topic

aussieboykie

Other than using multiple -ext options to specify which file extensions are in scope is there a way of restricting processing to common image/movie types such as jpg, png, mov, mp4, etc.?  Some sort of "image" group definition that could be included without having to specify each group member individually?

StarGeek

You could check the MIMEType
-if "$MIMEType=~/image/"
-if "$MIMEType=~/video/"

Though I think that using -ext would be quicker because I think that this will still do some processing on each file to see if it matched, while -ext will ignore any file that's not included.  You could make an args file with multiple ext options.  For example, creating a Movies.args
-ext
mp4
-ext
mkv
-ext
avi
-ext
m4v
-ext
ts

And then you could include it with -@ Movies.args
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

aussieboykie

Quote from: StarGeek on June 18, 2020, 09:07:39 PM
You could check the MIMEType
-if "$MIMEType=~/image/"
-if "$MIMEType=~/video/"
Thanks. I wasn't aware of MIMEType. Can I rely on MIMEType being present? From some quick tests on a variety of files, including scanned images and some very old images, it certainly looks like testing for one or other of these to be true does the trick.

Phil Harvey

MimeType should always be present unless there was an error reading the file.  If it isn't, let me know because that would be a bug.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).