09-27-2022, 10:11 PM
(This post was last modified: 09-27-2022, 10:13 PM by mnrvovrfc.
Edit Reason: Need to use "LTRIM$()" anyhow in added code line
)
Also decide if the first file, if the filenames are to be sorted, will be "RECORD1.DAT" or "RECORD01.DAT", for less than a hundred files. Because Windows file manager could boggle the mind with how it sorts by filename. If the OP only cares about "RECORD1.DAT" for the first file and "RECORD10.DAT" for the tenth, then the post by @Dimster is enough for the solution. Otherwise if the serial number must be two digits, must insert this line just below the "Rnum$" assignment:
IF i < 10 Then Rnum$ = "0" + Ltrim$(Str$(i))
IF i < 10 Then Rnum$ = "0" + Ltrim$(Str$(i))