ExifTool Forum

ExifTool => Newbies => Topic started by: lmiol on June 25, 2023, 09:06:16 AM

Title: How to add zero to num %nC from 1 to 9 only?
Post by: lmiol on June 25, 2023, 09:06:16 AM
-Exif:DocumentName<$filename -tagsfromfile "PXL_20230617_172302528.BURST-1.jpg" "-filename<PXL_${DateTimeOriginal;my $temp=$self->GetValue('OffsetTimeOriginal');$temp=~tr/-+/+-/;ShiftTime($temp);DateFmt('%Y%m%d_%H%M%S')}${subsectimeoriginal}.BURST-%nC.%e" -fileorder filename .
Right now here "%nC" nums like this:
1
2
..
9
10
11

how to add zero but only from 1 to 9?
01
02
..
09
10
11
?

thx in advance
Title: Re: How to add zero to num %nC from 1 to 9 only?
Post by: lmiol on June 25, 2023, 09:28:11 AM
chatgpt suggest this one
%2nc
but i got this result
02
03
...
09
10
11

but 01 doesn't created
Title: Re: How to add zero to num %nC from 1 to 9 only?
Post by: lmiol on June 25, 2023, 09:31:13 AM
Solution found (chatgpt 4)
this one works great
%2.2nc
Title: Re: How to add zero to num %nC from 1 to 9 only?
Post by: StarGeek on June 25, 2023, 12:19:13 PM
See the -w (-TextOut) option (https://exiftool.org/exiftool_pod.html#w-EXT-or-FMT--textOut) under "Advanced features".  The docs detail all the options for the % variables.