Rename/renumber files like this: 1A, 1B, 1C, 1D, 2A, 2B, 2C, etc.
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!
I would like to rename/renumber files like this:
1A
1B
1C
1D
2A
2B
2C
2D
3A
3B
etc.
Any suggestions? Thank you!
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
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