I am tryig to rename some files, but it is quite possible that another file with the same name (the name I’m trying to rename to) already exists in the same location. When this happens, I show an error message with 2 options:
-
Choose another name and continue…
-
Simply Overwrite the one that already exists…
The second is the problem. Right now I have code that first deletes the file already there, and then sets the name of the other file. Using this method I get the nice little “move to trash” sound from the Finder. I’d like to avoid this. What do you recommend?
My code is:
delete POSIX file theFileThatExists
set name of file theFileToRename to theFilename
THANKS!