Hi all,
sorry for maybe a trivial question. I'd like to rename the files by shuttercount in six-digit format (eg. 012345), but I can't figure out the correct pattern. Can someone please help me? Thanks.
exiftool -if "${ShutterCount}" "-FileName<${ShutterCount}_%f%E" -r .
From this previous post (https://exiftool.org/forum/index.php/topic,7974.msg40666.html#msg40666)
"-Filename<${ShutterCount;$_=sprintf('%06d',$_)}"_%f%E"
"-Filename<${ShutterCount;$_=substr('000000'.$_,-6)}"_%f%E"
"-Filename<${ShutterCount;$_='0' x (6-length).$_}"_%f%E"
Plus a new one userful for padding multiple occurances of numbers already part of a string (e.g. "7 of 9" -> "007 of 009"), a variation of the first one. Not as useful for this purpose, but adding it so I can link to this post at a later date.
"-Filename<${ShutterCount;s/([0-9]+)/sprintf('%06d',$1)/ge}"_%f%E"
Totally did it. Thank you for the quick answer!