Rename/renumber files like this: 1A, 1B, 1C, 1D, 2A, 2B, 2C, etc.

Advanced Renamer forum
#1 : 27/09-22 23:11
Gerald C Peters
Gerald C Peters
Posts: 1
Hi,

I would like to rename/renumber files like this:

1A
1B
1C
1D
2A
2B
2C
2D
3A
3B
etc.

Any suggestions? Thank you!


27/09-22 23:11
#2 : 28/09-22 14:54
David Lee
David Lee
Posts: 1125
Use a simple Script method with just a return statement:

return Math.floor(index/4) + 1 + String.fromCharCode(65 + index % 4);

Basically, you are dividing the index number of each file in the list by 4 and returning the integer part and remainder.

Add one to the real part because you want filenames to start from 1 not zero.

A is ASCII character 65 and "index % 4" will return the remainder 0, 1, 2 or 3 - so the second part of the statement adds the character A, B, C, or D as appropriate


28/09-22 14:54