Permanently delete files via AppleScript
Nov 29, '07 07:30:00AM
Contributed by: tomote
Ever since switching to OS X from Windows, I've missed the convenience of being able to permanently delete files using Shift-Delete. In order to duplicate that functionality, I've written a short AppleScript that will delete the files selected in Finder instead of placing them in the trash.
The best way to use this script is to assign it to a shortcut key (e.g., shift-backspace) using a program like Spark.
Notes:
- The script first moves files to the trash before permanently deleting them. This prevents accidentally deletion of protected or system files.
- The script will not delete or remove files that have a duplicate filename already in the trash.
- It will not remove files which are not on the local hard drive.
- It will only launch if the foremost active window is Finder.
[robg adds: Beyond making sure the code compiles, I have not tested this script. However, if you intend to use this, please do all your testing on a copy of a copy of a non-critical file, and make sure that your backups are current. It should go without saying, but this is a potentially very dangerous hint -- use it incorrectly, and the file(s) you've chosen are gone for good with no recourse for recovery.]
Comments (7)
Mac OS X Hints
http://hints.macworld.com/article.php?story=20071114065424440