Renaming a file to an existing filename

This has to be simple, but I can’t find the command. I keep getting errors.

Trying to move a file to the desktop where a duplicate filename exists wheras I replace that duplicate with the one I’m moving.

If you look in Finder’s AppleScript dictionary, you should find a move command. If you select it, you should see something like this:

This should lead you to code that looks something like this:

tell application "Finder"
	move file "path:to:file" to folder "path:to:destination:folder:" replacing true
end tell

When the code above is compiled, it might look like this:

tell application "Finder"
	move file "path:to:file" to folder "path:to:destination:folder:" with replacing
end tell

– Rob