Adding a set amount to the number part of a file name.

Would you like Bulk Rename Utility to offer new functionality? Post your comments here!

Adding a set amount to the number part of a file name.

Postby SeanMck » Tue Apr 28, 2020 11:20 pm

Say I have a set of photos with the following names and that, for the purposes of this question, they are sorted by name or date/time-taken.
homer-0001.jpeg
homer-0002.jpeg
homer-0003.jpeg
homer-0004.jpeg
homer-0004.DNG
homer-0004.RAW
homer-0005.jpeg
homer-0006.jpeg
homer-0006.RAW
homer-0007.jpeg
.
.
.
.
homer-0559.jpeg

Imagine I boobed and had acidentally changed the naming scheme that the camera uses such that the camera resets the count to zero everytime the memory card is removed, emptied and replaced rather than continuing from the last number used. The filenames of the next cardful will start at homer-0001.
If I want to save the photos in a common folder I need to offset the names of the second block of photos by 559 so that the first photo in the second block becomes homer-0560.jpeg.
As there are photos of the same name but differing file types I can not simply increment the number part, the same problem arises where photos have been deleted etc.
Previously I have, between the breaks in continuity, erased the number bit and incremented the replacement but it gets very tedious if a lot of photos have been deleted.
Am I missing the way to do it? If not is it possible that this option could be added?
Thanks
SeanMck
 
Posts: 2
Joined: Tue Apr 28, 2020 10:41 pm

Re: Adding a set amount to the number part of a file name.

Postby Ric » Fri May 01, 2020 3:34 pm

Cannot guarantee but it is highly likely that ExifTool could accomplish this quite easily.

Suggest SeanMck look at the EXIFTOOL utility. https://exiftool.org/
Ric
 
Posts: 13
Joined: Fri Apr 10, 2020 6:17 pm

Re: Adding a set amount to the number part of a file name.

Postby Ric » Fri May 01, 2020 6:40 pm

BRU has regular expressions so .....
There are a few examples online showing how to do arithmetic in regular expressions.
The reality is those examples are really showing arithmetic in a regular expression embedded in a line (or more) of Perl code.
Best I can tell arithmetic in regular expressions (pure regex) is not possible.

So, either the Javascript option in BRU, or alternatively learn and use Perl.
Ric
 
Posts: 13
Joined: Fri Apr 10, 2020 6:17 pm

Re: Adding a set amount to the number part of a file name.

Postby SeanMck » Tue May 19, 2020 4:07 pm

Ta Rick from memory exiftool on its own gives my laptop a headache BUT I think one of other programmes uses it. I will have a look at reg exp etc. thanks
SeanMck
 
Posts: 2
Joined: Tue Apr 28, 2020 10:41 pm


Return to Suggestions