3
Answers

Iterate file names for highest numeric value

iain

iain

13y
1.5k
1
Hi Everyone,

I wonder if someone might be able to help on an iteration issue. I have a directory of files all of which will have constant values and a numeric variable as their file name (e.g. file1.txt, file2.txt, file3.txt). this directory is written to as part of an indexing process.

What I need to do is write a bit of code that looks through that directory and establishes what the next sequence number will be. Using the example above, the next sequence number will be 4. (file4.txt).

I'm having a bit of a brain freeze and cant think how I can do this. Can anyone help?

Many thanks
Answers (3)