http://www.bulkrenameutility.co.uk/forum/viewtopic.php?f=2&t=4849#p13292This a link using the javascript to
add 559, but its also only renaming the files that do
end with a number.
So this a modification to rename files with having only 1-number in the middle, but at least 3-digits long.
Also, the number must be at least 016, since because its always subtracting 16 away from the middle number...
if (/^[^\d]+(?!0(0\d|1[0-5])[^\d])\d{3,}[^\d]+$/.test(name)) {
beg=name.replace(/^(.*?)\d+.*$/,'$1') //.... beg == Begin of Name
end=name.replace(/^.*?\d+(.*)$/,'$1') //.... end == End of Name
num=name.replace(/^.*?(\d+).*$/,'$1') //... num == Middle digits
xxx=num.length // ............................. xxx == How many Middle digits? (
with LeadZeros)
sub=parseInt(num,10)-16 // .................. sub == Middle digits - 16 (in decimal)
yyy=sub.toString().length // .................. yyy == #digits in sub (no LeadZeros)
zer='0'.repeat(Math.max(0,xxx-yyy)) //...... zer == LeadZeros (if needed)
newName=beg+zer+sub+end} // .............. NewName == BeginName + LeadZeros(if needed) + Subtraction + EndName
If all filenames are like the example, then Line-1 can be...
if (/^Abcdefg(?!0(0\d|1[0-5]))\d{3,}hij$/.test(name)) {If needing to subtract 16
only from 3-digits instead of 3-or-more, then should also change
\d{3,} ===>
\d{3}