ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: ahatzz11 on July 08, 2017, 04:49:35 PM

Title: if condition to look for capitalization in an extension
Post by: ahatzz11 on July 08, 2017, 04:49:35 PM
Hello! I've done some searching on the form, and a lot of playing around, but haven't been able to figure this out yet.

I'm looking for a way to find images with a capitalized extension e.g. process .JPG but not .jpg.

The -ext option seems to be case insensitive.

I've also tried exiftool -AllDates -if "$FileExtension eq '*.JPG'" ., but that doesn't seem to work either.

Any help on this would be awesome, thanks!

Title: Re: if condition to look for capitalization in an extension
Post by: StarGeek on July 08, 2017, 06:30:16 PM
Since you mention the FileExtension tag, I assume you have the example config file (http://www.exiftool.org/config.html) set up.  In that case, you're really close, you just need to remove the AsteriskDot part.
exiftool -AllDates -if "$FileExtension eq 'JPG'" .

For others who don't have that installed, the following will work.
If you're looking for exactly JPG and not worrying about jPG or other variations, you can use this:
exiftool -alldates "$filename=~/\.JPG($)/"

If you want to grab everything that doesn't match jpg, then you could use this
exiftool -alldates "$filename!~/\.jpg($)/"
Title: Re: if condition to look for capitalization in an extension
Post by: ahatzz11 on July 08, 2017, 07:43:34 PM
I didn't have that installed, but I did that and it didn't work, but I switched up some quotes and it's working!

exiftool -AllDates -if '$FileExtension eq "JPG"' .