Renaming photos with an incrementing number from 1 to 8

Advanced Renamer forum
#1 : 25/05-24 19:13
Maria Maximiadi
Posts: 3
Hello,

I want to rename photos from camera traps and group them by the trigger point that shots 8 rapid photos at once. That means I want to add an incrementing number from 1 to 8 for every 8 photos that have been taken at the same second. Is it possible?

Thank you for your time!
#2 : 25/05-24 20:11
Delta Foxtrot
Posts: 323
Reply to #1:

Hi Maria,

Welcome and Kalí méra! :)

I suspect you'll need a little script to do that. The renumber method isn't equipped to do it and regex famously can't do math, so...

Can you show us a representative sample of the filenames as they come out of the cameras? It shouldn't be too tough a situation to deal with, but I don't understand how a camera can output shots with sub-second differentials without already appending some sort of sequence number. (?)

Also, in the meantime, try this and preview it and see if it gets you close to what you want. If it's not, don't bother to execute the batch.

Starting with an empty method list, add an ADD method:
Add: _<UnixTimestampCreated>
At index: 0
Backwards: CHECKED
Use regular expressions: UNCHECKED
Apply to: Name

Add a REMOVE PATTERN method:
Pattern: <RSubstr:3:_>
Case sensitive: UNCHECKED
Use regular expressions: UNCHECKED
Apply to: Name
(There should be no spaces in either method)

That probably won't do what you want, exactly, but it's worth a try.

Best regards,
DF
#3 : 26/05-24 09:08
Maria Maximiadi
Posts: 3
Reply to #2:
Hello Kali mera to you too! :)

I tried your suggestion, but unfortunately it didn't work. A sample of the filenames of the camera would be IMG_0001,IMG_0002,IMG_0003,IMG_0004... IMG0335 etc., ignoring the trigger point. So for an example, IMG_0001 to IMG_0008 belong to the same trigger point, IMG_0009 to IMG_0016 to another etc.

The final name that I want to give to the files ideally should be like: 20240506_182724_001, 20240506_182724_002..., 20240506_182724_008 and for another trigger point should be the same, for example: 20240506_182802_01...20240506_182802_02 etc. So basically for every 8 photos I want the incrementing number to start over.

Thank you again for your time.

All the best,
Mary
#4 : 26/05-24 11:28
Delta Foxtrot
Posts: 323
Reply to #3:

Ok, Maria, here you go.

This script will do what you want, as long as the date-time combination is not repeated somewhere in the set of files (more than the requisite eight times, of course).

In an empty method list open a SCRIPT method. You will see a button at the top left named "Pre batch script...". Press that button and a little window will pop up; in that window copy/paste the following line:

const currentCounter = 0;

(including the semicolon). Click the "Close and apply script button at the bottom right and that part will disappear. Now, in the main part of the script method window copy/paste the following lines (just below where it says "function(index,item) {"

var newName = app.parseTags("<Date Created:yyyymmdd>")+"_"+app.parseTags("<Time Created:hhmmss>")+ "_00";

currentCounter = currentCounter + 1;

if (currentCounter == 9){
currentCounter = 1;
}
newName = newName + currentCounter.toString();
return newName;

Click the "Apply script" button (top right). Now load your files (making sure that they are in filename order so the renumbering will apply correctly).

Here's more or less what you should see at the various points in the process:

https://drive.google.com/file/d/17Cp-nCf7u2GIGkC QJyUkcIhxuTqiRwMU/view?usp=sharing

That's it. If you have problems let me know. If you don't have problems let me know! :)

EDIT: Be sure to check the preview of the new filenames for problems before you click the "Start batch" button; and remember, if you find problems after renaming you can always undo the batch to the old filenames. END EDIT

Best regards,
DF


edited: 26/05-24 11:32
#5 : 07/06-24 19:11
Maria Maximiadi
Posts: 3
Reply to #4:
Sorry for my late response,

It worked perfectly!! Thank you!

All the best,
Mary