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)}
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

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.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype