There’s two parts to this:
I suspect you’re asking about the first one. If so, I presume that you start out with the list of file names that need to be renamed in a batch [1]. Do you know whether that list is already sorted? That is, in your first example, is there any chance that AJTHGH-BK-48367.jpg could be anywhere other than the first item?
And can there be any gaps? That is, could you have a list like AJTHGH-BK-48367.jpg, AJTHGH-BK-48368.jpg, AJTHGH-BK-48370.jpg, and AJTHGH-BK-48371.jpg. And, if so, do you want there to be a matching gap in the new names?
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] You need to start out with the full list because to do this incrementally you’d have to know which file has the lowest number.