Filerename duplicate check

Is there a way to prevent filerename from creating a duplicate filename that ends up overwriting another file?

I have a collection of thousands of newspaper clippings that are labeled in the form PaperName_mm_dd_yyyy.pdf , with optional indentifiers after the year marks for articles from the same date and articles that are broken into two or more pieces (eg PaperName_mm_dd_yyyy_2_a.pdf).

What I am working on is just correcting spelling errors in the PaperName by having the procedure check the name in the file against a variable with the correct spelling.

The problem I’m trying to get around is that occasionally, the new name for the file is already taken by another file, so I will need to append another identifier to the renamed file. Is there any sort of error warning that filerename has built in - like when you manually try to save duplicate names - or do I have to create my own(maybe with fileexists)?

Martin

The filerename statement already checks to see if it is about to overwrite a file, and returns an error in that situation. So you could accomplish your goal with code something like this:

filerename "hello.txt","goodbye.txt"
if error
    filerename "hello.txt","adieu.txt"
endif

Thanks, that works.