10.4: Secure delete items directly from the Finder

Sep 06, '05 09:31:00AM

Contributed by: calum

Tiger only hintI was getting annoyed with having to either move stuff to Trash and secure delete it there, or to open a Terminal and use srm.

To ease my frustrations, I hacked up my first Automator workflow. Launch Automator, and then add these actions:

  1. In the Library column, choose the Automator item, then drag the Ask for confirmation: Action to the work area on the right. Set the Message to Securely delete selected file(s)? and the Explanation to This operation cannot be undone.

  2. Now select the Finder entry in the Library column, and drag the Get Selected Finder Items Action to the work area, below the previous command.

  3. Finally, choose the Automator Library item again, and drag the Run Shell Script action to the bottom of the work area. Make sure that the Shell variable is set to /bin/sh, and change the Pass Input pop-up to as arguments. For the script itself, use the following:
    #!/bin/sh
    for i in "$@"
    do
      srm -rmf "$i"
    done
    
Save this as a Finder plug-in (File: Save as Plug-in; I called mine "Secure Delete"), and now you can select any number of files/folders in Finder, control-click on the selection, and then select Automator -> Secure Delete from the contextual menu. Files deleted this way are obviously not recoverable, which is why I added the confirmation step ... you can omit that action if you're brave enough.

I'd love to make this even more useful by creating a keyboard shortcut for it, but although I can create the shortcut in the Mouse & Keyboard control panel, and it shows up on the Finder contextual menu, it doesn't work. Anyone managed to do this yet?

[robg adds: Be aware that secure deleting takes a bit of time, so if you think the plug-in isn't doing anything, make sure you check teh Autmator status indicator in the menu bar; it will let you know that it's still working on deleting your selection. In testing, it took roughly 35 seconds to delete an 860KB test file on my 2.0GHz Dual G5.]

Comments (18)


Mac OS X Hints
http://hints.macworld.com/article.php?story=2005083108535112