ExifTool Forum

ExifTool => Newbies => Topic started by: Stephen Marsh on September 15, 2017, 09:05:08 AM

Title: Add Missing Filename Extension
Post by: Stephen Marsh on September 15, 2017, 09:05:08 AM
Is it possible to use metadata to add in a missing filename extension?

The following does not work, probably because the arguments and syntax is all wrong:

exiftool -ext '*' -if '$FileType=JPEG' -filename='%%f.jpg' 'DIR'

The idea being that there may be FileType=JPEG or FileType=TIFF etc. Hoping to get one to work, before looking into multiples.
Title: Re: Add Missing Filename Extension
Post by: StarGeek on September 15, 2017, 01:55:38 PM
You're using a numeric comparison = instead of a string comparison eq.

But Phil added a simpler solution a couple years ago.

exiftool -ext * "-filename<%f.$fileTypeExtension" DIR

Title: Re: Add Missing Filename Extension
Post by: Stephen Marsh on September 15, 2017, 07:37:16 PM
Fantastic, thank you StarGeek!