Hi,
I just found this topic https://exiftool.org/forum/index.php?topic=11054.0 (https://exiftool.org/forum/index.php?topic=11054.0) (Subsec workaround for Olympus: read shot sequence number from tag "Drive Mode"). I'm using this now in a batch file for adding the shot number of continuous shots to my filenames:
Quoteexiftool -if "$drivemode =~ /Continuous/" "-FileName<${EXIF:DateTimeOriginal}_${drivemode;$_ = /Shot (\d+)/ ? $1 : undef}%%-c.%%le" -d "%%Y-%%m-%%d-%%H%%M%%S" %1
It does now nearly what I want. But i didn't find out by now, how to add always 2 digits for the shot numbers, with leading zeros for numbers lower than 10. Is this possible?
Many thanks in advance and best regards
Friedemann
Hi Friedemann,
Try this:
exiftool -if "$drivemode =~ /Continuous/" "-FileName<${EXIF:DateTimeOriginal}_${drivemode;$_ = /Shot (\d+)/ ? sprintf('%.2d',$1) : undef}%%-c.%%le" -d "%%Y-%%m-%%d-%%H%%M%%S" %1
- Phil
Hi Phil,
many thanks for the quick answer! :)
With your suggestion
exiftool -if "$drivemode =~ /Continuous/" "-FileName<${EXIF:DateTimeOriginal}_${drivemode;$_ = /Shot (\d+)/ ? sprintf('%.2d',$1) : undef}%%-c.%%le" -d "%%Y-%%m-%%d-%%H%%M%%S" %1
I get this on the commandline
Warning: Can't find string terminator "'" anywhere before EOF for 'drivemode' - 0262.dng
and a filename like "0262.dng" becomes
2021-03-28-144320_Continuous Shooting, Shot 3; Electronic shutter.dng
instead of
2021-03-28-144320_03.dng
Best regards
Friedemann
Batch file? Try doubling the % sign
sprintf('%%.2d',$1)
Oh yes, of course, doubling the % did the job... :-[
Many many thanks, to you both, it works perfect now! :)
Best regards
Friedemann