How do you replace a folder if it is already created on the desktop

I am trying to create a new folder on the desktop using the following command, this works fine but I want to be able to replace a folder if it already exists… is is possible to do this? The code below will give an error if the folder titled “TestFolder” already exists on the desktop…

tell application “Finder” to make new folder at desktop with properties {name:“TestFolder”}

Two solutions I can think of are searching for the existence of the folder first, and deleting it if it already exists before making the new folder:

tell application "Finder"
	set theFolder to "TestFolder"
	if folder theFolder of desktop exists then delete folder theFolder
	make new folder at desktop with properties {name:theFolder}
end tell

Or, the move command has a replace boolean - to quote the dictionary: “[replacing boolean] – Specifies whether or not to replace items in the destination that have the same name as items being moved”
You could make the folder somewhere and then move it to the desktop with replace set to true.

jON bEEBE

Or another way:

tell application "Finder"
	set myFolder to "TestFolder"
	try
		make new folder at desktop with properties {name:myFolder}
	on error
		delete folder myFolder
		make new folder at desktop with properties {name:myFolder}
	end try
end tell