Creating filenames by serial number

Continuing the discussion from
Guys please help, I have unique doubt?:

Guys please help, I have unique doubt?:

Hi there

I want to create filenames by serial number .I found the topic above and its almost work,but it stop at file10.

I’m asking for help how to create filenames like from 1-999.THX

1 Like

hello @zxc456183
you can try this
i replaced only \d to \d{3}

Directory.GetFiles(“path”).Select( Function(w) Regex.Match(w.ToString,“\d{3}+”).Value ).Max


1 Like

thanks for your reply,but It can’t work


1 Like

Hi @zxc456183,

Put that array of files in For Each loop. Get it’s index and add it with file name. So you can create a file name with serial number.

Note: Index was starts from 0. So add 1 with index number.

You can also use while conditions with count increment.

intCount = 999
intIncrementCount = 0
While intCount >= intCount
intIncrementCount = intIncrementCount + 1
filename = filename + “_” + intIncrementCount.toString

Michael Udhaya