So, if we assume that you already have a list of strings containing the filenames you'll need to:
- Iterate over the strings in that list
- For each filename:
- identify the number. This should be easy - find the position of the . in the string, and the number is the part of the string that begins with the 4th character, and ends before the position of the .
- Keep track of the highest number found so far, and update it if the number you've just found is higher than the the previous value
- Once you've iterated over all the filenames, you'll have your highest number. Add one to it.
- Create a new string, containing a new filename which contains your new number
There's really nothing wrong with seeking as many opinions on as you can get. New programmers especially do not have the knowledge to judge the quality of the responses they get. Only by asking and exploring does someone begin to be able to choose whom they prefer. And even for the first few years cross-posting questions feels like a winning strategy.
For the poster, the only downside is when people get mad at them for the multiple posts.
Now, if someone multiple-posts (same site or different) because they don't like the (good) advice given them, either here or elsewhere, then I'll just ask what was wrong with the advice already offered.