#1 : 14/04-22 14:20 Kaan
Posts: 2
|
Hi everyone!
I have a lot of documents with a rising number in the name. Like: axx_01_yyyy bxx_02_yyyy cxx_03_yyyy dxx_04_yyyy exx_05_yyyy Unfortunately now I have to add new files in between the numerical oder. Has anyone an idea, how I can renumber all my files and skip specifc numbers? For example: Skip number 3 and 5. axx_01_yyyy bxx_02_yyyy cxx_04_yyyy dxx_06_yyyy exx_07_yyyy Thanks! |
#2 : 14/04-22 15:20 David Lee
Posts: 1125
|
Use a script method.
Extract the number from the middle of the string If the number is greater than or equal to 3 then increase it by 1 If the resulting number is greater than or equal to 5 then increase it by 1 again (repeat ad lib to skip any further numbers) Finally rebuild the filename, zero-padding the number to 2 digits. Copy this code into the Script Window: match = item.name.match(/([^_]*_)([^_]*)(.*)/); d = match[2]; if (d >= 3) d++; if (d >= 5) d++; return match[1] + ('0' + d).slice(-2) + match[3]; |
#3 : 14/04-22 16:23 Kaan
Posts: 2
|
Thank you! Works perfect!
|