ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: tommyzebman on June 02, 2017, 07:01:18 PM

Title: How to rename file with shuttercount but limit to last 4 digits?
Post by: tommyzebman on June 02, 2017, 07:01:18 PM
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.
Title: Re: How to rename file with shuttercount but limit to last 4 digits?
Post by: StarGeek on June 02, 2017, 08:38:46 PM
For Shuttercount, try
${ShutterCount;$_=substr('0000'.$_,-4)}
Title: Re: How to rename file with shuttercount but limit to last 4 digits?
Post by: tommyzebman on June 02, 2017, 11:35:47 PM
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.
Title: Re: How to rename file with shuttercount but limit to last 4 digits?
Post by: StarGeek on June 03, 2017, 01:24:56 AM
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.