ExifTool Forum

ExifTool => Newbies => Topic started by: k.mooijman on January 04, 2024, 04:50:16 PM

Title: Can I (and if yes how?) add parenthesis to the %c auto increment?
Post by: k.mooijman on January 04, 2024, 04:50:16 PM
I use
exiftool '-filename<${subsecdatetimeoriginal;DateFmt("%Y-%m-%d_%H-%M-%S_%f")}_${make#;s/\s/-/}_${model#;s/\s/-/}_%-.2c.%e' *.jpg
to achieve this

2019-07-25_12-00-01_.60_NIKON-CORPORATION_NIKON-D5300.jpg
2019-07-25_12-00-01_.60_NIKON-CORPORATION_NIKON-D5300_-00.jpg
2019-07-25_12-00-01_.60_NIKON-CORPORATION_NIKON-D5300_-01.jpg

but would like to get

2019-07-25_12-00-01_.60_NIKON-CORPORATION_NIKON-D5300.jpg
2019-07-25_12-00-01_.60_NIKON-CORPORATION_NIKON-D5300(00).jpg
2019-07-25_12-00-01_.60_NIKON-CORPORATION_NIKON-D5300(01).jpg

Is this possible and if 'yes' how?

 

Title: Re: Can I (and if yes how?) add parenthesis to the %c auto increment?
Post by: Phil Harvey on January 05, 2024, 08:10:44 AM
This may be done with a second command after setting them to -00.jpg etc:

exiftool "-filename<${filename;s/-(\d{2})\./($1)/ or $_=undef}" DIR

But try this out first on some test files to be sure it does what you want.

You will get warnings for files that aren't renamed.

- Phil
Title: Re: Can I (and if yes how?) add parenthesis to the %c auto increment?
Post by: k.mooijman on January 06, 2024, 08:38:05 AM
Thanks for the answer. But it is not the solution I was looking for.
I'm afraid that once again I'm trying something impossible.
It wouldn't be the first time  ::)
Title: Re: Can I (and if yes how?) add parenthesis to the %c auto increment?
Post by: Phil Harvey on January 06, 2024, 09:36:15 AM
The alternative is to always add a copy number, then there isn't the problem because the brackets are always written.  Then afterwards you could remove the "(00)" if you wanted.  But of course the numbers would start with "(01)" then.

- Phil