Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,000 hints and counting!


Click here to return to the 'Permanently delete files via AppleScript' hint
The following comments are owned by whomever posted them. This site is not responsible for what they say.
Permanently delete files via AppleScript
Authored by: gshenaut on Fri, Nov 30 2007 at 10:17AM PST
For a simpler--but equally dangerous--method of removing files, use an Automator Finder plug-in. I have one I call "Expunge", with two actions. The first action is an Automator "Ask for confirmation" screen, and the second one is a simple "Run shell script" that takes the selected files as command line arguments, and applies "rm -rfP" to each one, in a for loop. I save this workflow as a Finder plugin, and voilĂ . When you control-click on one or more objects in the Finder, you just slide down to the "Automator" submenu and select Expunge to delete them immediately and permanently.

[ Reply to This | # ]
Permanently delete files via AppleScript
Authored by: V.K. on Wed, Dec 5 2007 at 4:47PM PST
here is a variation of the above to delete all files in a folder.
Make an automator action consisting of the following simple shell script:

for f in "$@"
do
rm "$f"/*
done



Save the automator action as a finder plug-in and there you have it.
Right-clicking on a folder and choosing your plug-in from the contextual menu will delete all the files in that folder. As Rob says be careful using this!

[ Reply to This | # ]