Syntax for Deleting a File

[Oddly, use of the search engine didn’t turn this up…]

What is the proper syntax for deleting a file with the Finder (not command-line)? Want to make sure I do it right before letting my script loose on the server. :wink:

Hi Kevin,


tell application "Finder"
	delete file "Path:To:File"
	-- empty trash
end tell

if you want to delete the file permanently, uncomment the empty trash line

If you wish to delete a file leaving no trace in the trash, you may use something like:

set leFichier to "Macintosh HD:Users:yvan_koenig:Desktop:Bonjour2 - copie.doc"
do shell script "rm -d " & quoted form of POSIX path of leFichier

The -d is useful if leFichier may be a folder.

Yvan KOENIG (from FRANCE mercredi 13 août 2008 17:29:46)

:wink:

Oops

I missed that :frowning:

Yvan KOENIG (from FRANCE vendredi 15 août 2008 19:31:26)