photools.com Community

IMatch Discussion Boards => FAQ, Workflow, Tutorials, Tips & Tricks => Renaming and Distributing Files => Topic started by: BenAW on October 23, 2013, 10:48:36 AM

Title: Renaming using the camera generated image count
Post by: BenAW on October 23, 2013, 10:48:36 AM
A lot of cameras create filenames where the last 4 digits are a camara specific image counter, like:

DSC_xxxx.JPG
P100xxxx.JPG
IMGPxxxx.PEF

If you want to use the imagecounter xxxx in a new filename, use this variable:  {File.Name|substrr:0,4}

A Renamer preset that is good for all filenames that have this counter, regardless of the rest of the name, looks like this:

(https://www.photools.com/community/index.php?action=dlattach;topic=1161.0;attach=2512)

[attachment deleted by admin]
Title: Re: Renaming using the camera generated image count
Post by: Mario on October 23, 2013, 12:59:29 PM
For the likes like me who read too fast and then wonder:

{File.Name|substrr:0,4}

the key is the r at the end of the substrr, it extracts from the end of the file name.

If your image counters becomes larger that four digits (10,000+ files) the above substring will fail to extract the complete number.

Another approach which will work nicely when your camera uses a fixed-length prefix like _DSC or IMGP followed by any number of digits is using substring:

{File.Name|substr:4}

This strips the first 4 characters from the file name, so the _DSC or IMPG prefixes will be removed.


Digits of Original File Name

Yet another alternative is to use the Digits of Original File Name step which extracts all digits from the original file name by searching for the first digit (ignoring any leading characters or _) and then stops when the first non-digit is reached (the . of the extension usually).

Whatever your specific rename problems may be, there is a very good chance that you can find one or more approaches with the arsenal of features provided by the Renamer.
Title: Re: Renaming using the camera generated image count
Post by: nacho02 on April 22, 2014, 09:25:06 PM
Very useful Topic. Thanks both of you for posting this.