How to rename file with shuttercount but limit to last 4 digits?

Started by tommyzebman, June 02, 2017, 07:01:18 PM

Previous topic - Next topic

tommyzebman

How to rename file with shuttercount but limit to last 4 digits?

I guess it is self explanatory.  Actually I will combine with date separated by _.

I have this (below) thus far - just want to limit shuttercount to last four digits.  Thanks.

exiftool "-filename<${DateTimeOriginal}_${ShutterCount}%-c.%e" -d %Y%m%d -r "Directory"

I guess it would be good if it padded with zeros if shutter count was less than 1000.

StarGeek

For Shuttercount, try
${ShutterCount;$_=substr('0000'.$_,-4)}
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

tommyzebman

Thanks.  Not quite as simple as %-4f.  Is there somewhere that provides this type of instruction?  I would have never guessed it would take that many instruction codes.

StarGeek

The $_=substr('0000'.$_,-4) is Perl programming language.  You can find bits on this forum but if you really want to get into it there are lots of tutorials out there.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).