numbers restart for each file type

Advanced Renamer forum
#1 : 19/05-21 06:52
dingus
dingus
Posts: 4
is there a way to stop the number from restarting for each file type? here's an example:

my files are currently like this:

example 1.jpg
example 1.mp4
example 1.webm
example 1.gif
example 2.jpg
example 2.mp4
example 2.webm
example 2.gif
example 3.jpg
example 3.mp4
example 3.webm
example 3.gif
and so on...

i would prefer it like this:

example 1.jpg
example 2.mp4
example 3.webm
example 4.gif
example 5.jpg
example 6.mp4
example 7.webm
example 8.gif
example 9.jpg
example 10.mp4
example 11.webm
example 12.gif

thank you for reading, i hope i explained properly


19/05-21 06:52
#2 : 19/05-21 10:21
David Lee
David Lee
Posts: 797
You haven't explained at all!

However, if we assume that you have renamed all your files with the same new name "example" and have applied the collision rule "Append number" with space as the separator then we would expect to see the result you describe as your current names - except that the numbers would be zero-padded to 3 digits (eg example 001.jpg etc).

If that is what you are doing then use the <Inc Nr> tag when you rename the file - this will work for this example.

Try reading the User Guide!





19/05-21 10:21
#3 : 19/05-21 22:27
dingus
dingus
Posts: 4
Reply to #2:

i'm sorry!

i failed to mention that i didn't rename anything. i just want the numbers to change like this, if possible: https://i.imgur.com/1ehpTH3.png


19/05-21 22:27
#4 : 20/05-21 10:16
David Lee
David Lee
Posts: 797
Reply to #3:

You will need to use a script to keep track of the numbers.

See the User Guide for a basic introduction to the Script method:

https://www.advancedrenamer.com/user_guide/metho d_script
https://www.advancedrenamer.com/user_guide/examp le_scripting

In the Pre-batch script enter the code:

names = {};

and in the main script window:

name = item.name.match(/.*(?= \d+$)/)[0];
if (!names[name]) names[name] = 0;
return name + '_' + (++names[name]);

This will add an underscore character before the number at the end of each filename instead of a space. This is because if you were to rename exactly as you requested there would be "collisions". For example "bul 1.webm" would be renamed to "bul 2.webm" but this file already exists further down the list so the "name collision rule" would be applied, which, by default, would return "bul 2-001.webm".

If you want to retain the space then you will have to replace the "_" in a second run using a Replace method:

Replace: _(?=\d+$)
with: space
Use regular expressions



20/05-21 10:16
#5 : 20/05-21 20:50
dingus
dingus
Posts: 4
Reply to #4:

this works! thank you very much! :)


20/05-21 20:50