• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Really delete a file via AppleScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Really delete a file via AppleScript


  • Subject: Re: Really delete a file via AppleScript
  • From: Paul Skinner <email@hidden>
  • Date: Sun, 3 Aug 2003 08:48:49 -0400

On Saturday, August 2, 2003, at 09:42 PM, Michelle Steiner wrote:

On Saturday, August 2, 2003, at 06:26 PM, Neil Faiman wrote:

Is there a way from AppleScript to completely delete a file (i.e., free up its space right now, rather than just moving it to the trash)? 'tell application "finder" to delete file "foo"' moves it to the trash. Of course, I could do something like 'do shell script ("rm " & posix path to file foo)', but I'm looking for a "pure" AppleScript solution.

tell application "Finder"
set the file_to_delete to alias "Dora:Users:michelle:Desktop:foo.text"
delete the file_to_delete
empty the trash
end tell


and


do shell script ("rm " & posix path to file foo)

Both look like 'pure' AppleScript to me. And while Michelle's is exactly what you asked for, I suspect in practice that the DSS (do shell script) version is easier used. The method using 'empty the trash' should probably move all the contents of the trash to a temp folder outside of the trash, delete the file you want deleted, and then restore the previous contents of the trash. It's rude to empty people's trash without asking.

PS
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Really delete a file via AppleScript
      • From: Neil Faiman <email@hidden>
    • Re: Really delete a file via AppleScript
      • From: John Delacour <email@hidden>
References: 
 >Re: Really delete a file via AppleScript (From: Michelle Steiner <email@hidden>)

  • Prev by Date: Re: Getting desktop bounds (was: Re: Isn't there a way...
  • Next by Date: Re: Getting desktop bounds (was: Re: Isn't there a way...
  • Previous by thread: Re: Really delete a file via AppleScript
  • Next by thread: Re: Really delete a file via AppleScript
  • Index(es):
    • Date
    • Thread