DO
INPUT "Test a name fix, enter base name "; b$
PRINT nameFix$(b$)
LOOP
FUNCTION nameFix$ (base$)
IF LEN(base$) < 3 THEN nameFix$ = RIGHT$("000" + base$, 3) ELSE nameFix$ = base$
END FUNCTION
Is there really a chance that a file001.ext already exists for file1.ext?
I think the way I’d do something like this would be:
1) Shell DIR to a text file.
2) Read that file into an array.
3) Parse that Array for numeric values. If those values aren’t in ### format, create a new array to store the properly formatted name.
4) When finished, use a DO LOOP to NAME the files into the proper format in one quick batch.
Should be about the fastest way to process your files, I’d think.
You might want to take a look at the little program I wrote to manipulate Ebook titles into a proper format, much like what you’re describing you want to do here: http://qb64.freeforums.net/thread/18/hard-drive-folder-organization-tool