• 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
Another basic... delete - shell script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Another basic... delete - shell script


  • Subject: Another basic... delete - shell script
  • From: email@hidden
  • Date: Thu, 5 Feb 2004 09:18:20 +0000

Hi all,
Sorry for maybe asking the obvious (again)... but I seem to be
struggling with compatibility so...
Not wanting to clutter up the Trash, I use the following when deleting
some files:

on delete_file(the_file)
try
tell application "Finder" -- zero out the file and delete it
set file type of file the_file to " "
set trash_temp to open for access file the_file with write permission
set eof of trash_temp to 0
close access trash_temp
delete (file the_file)
end tell
end try
end delete_file

Now this works fine, moving the selected file to the Trash with a size
of 0KB, as expected.
For compatibility's sake, would it be safe to use the following in
Jaguar/Panther for any account type (admin/guest) users without any
need for password?

on delete_file(the_file)
do shell script "rm " & (quoted form of POSIX path of the_file) --
the_file is a Unicode string
end delete_file

Just so that the trash doesn't end up with loads of 0KB files.
Thanks for any pointers.
--
DP
_______________________________________________
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.

  • Prev by Date: Re: Very basic "write to file" query
  • Next by Date: Re: carriage return trouble
  • Previous by thread: is exposé scriptable?
  • Next by thread: Photoshop CS saving EPS with options
  • Index(es):
    • Date
    • Thread