MakeUniqueFileName checks to ensure the provided file name aFilename is unique.
If the name is not unique to one that already exists, it will add a number to the end of the filename portion, forcing it to be unique.
Declaration: Function MakeUniqueFilename(aFilename : string) : string
An example.
Another example you can test.