Rename incremental by pattern

Advanced Renamer forum
#1 : 01/09-18 09:27
Vlad
Vlad
Posts: 2
hi,
I have this files:

code1-003.jpg
code1-007.jpg
code1-012.jpg

code2-001.jpg
code2-005.jpg

how can i rename like this:
code1-01.jpg
code1-02.jpg
code1-03.jpg

code2-01.jpg
code2-02.jpg

or like this:

code1-a.jpg
code1-b.jpg
code1-c.jpg

code2-a.jpg
code2-b.jpg

thank you in advance.



01/09-18 09:27
#2 : 08/09-18 13:54
Spiro Conomos
Spiro Conomos
Posts: 15
Reply to #1:

Hi try this:

Add method, Script
Pre batch script:
fnum=0
fcount=1

Script:
function(index, item) {
fnumnew = item.name.substr(4,1);
if (fnumnew != fnum) {
fnum = fnumnew;
fcount = 0;
}
fcount = fcount+1;
return item.name.replace(/(code.).*/, "$1") + '_' + ("0000" + fcount).substr(-2,2);
}


08/09-18 13:54