Trying to update web photo's from Cell Phone?

Ok, here is the dilema. I want to be able to take a picture on a cell phone send it to my email and save the JPG with a specific file name in a specific Directory and have it over write the existing file? I have gotten as far as saving the file in the directory but have not figured out how to rename the file or overwrite the existing file.

I am assuming that I must delete the existing file before I write the new one but have no clue as how to do that!

Any help is greatly appreciated. I am a newbie to the mac environment… I am feeling pueny…!


An easy way to rename is this:

tell application "Finder"
set name of theFile to "New Name.jpg"
move theFile to "Path:To:The:Folder" with replacing
end tell

or to see a working example:

tell application "Finder"
	set theFile to (choose file)
	set theFolder to (choose folder)
	set theExt to (name extension of (info for theFile)) as string
	set name of theFile to "NewName" & "." & theExt
	move theFile to theFolder with replacing
end tell

Hope that helps.