ExifTool Forum

ExifTool => Newbies => Topic started by: athans on June 15, 2022, 09:30:24 AM

Title: adding suffix to filenames (before the extension)
Post by: athans on June 15, 2022, 09:30:24 AM

Hello

I'd like to add a suffix, say _xxx to each filename, before the extension. But somehow I have not figured out the proper syntax.
I ended up using a silly and inefficient solution of using an empty tag:

exiftool '-testname<%f_xxx$usercomment.%e'  .

but this does not sound right, and any attempt to just use the string _xxx in the expression failed.
Understanding I'm missing the obvious, I'd appreciate some help on this.
Thanks
Title: Re: adding suffix to filenames (before the extension)
Post by: StarGeek on June 15, 2022, 10:48:09 AM
This is Common Mistake #5c (https://exiftool.org/mistakes.html#M5), though the mistake is usually the other way around.

Use the Greater/Less than signs </> for copying tags.

Use the equal sign = when you're setting a static string.

exiftool '-testname=%f_xxx.%e'  .
Title: Re: adding suffix to filenames (before the extension)
Post by: athans on June 15, 2022, 11:21:08 AM
excellent. Obvious in retrospect.
Will brush up on common mistakes!