LaunchBar Action: Delete

Übersetzung verfügbar: Deutsch Deutsch

LaunchBar is my preferred application/file/script launcher on OS X. If you’re a LaunchBar user you know that it is very extensible through custom actions.

This little Action is called “Delete”. We all know that deleting files can quickly become boring. “Delete” brings back some variation and joy to the otherwise monotonous duty of file deletion. 😉

If you are a destructive mind like me you will surely like it. What it does is pure destruction in its most elegant form: By selecting/sending one or more files to the Action you can choose to…

  • Instantly delete the file
  • Securely overwrite and delete the file in various manners
  • Overwrite the content, without deleting the file
  • Delete the data fork
  • Delete the resource fork
  • Delete all extended attributes
  • Delete the metafiles .DS_Store and Icon?
  • Delete empty folders
Deletion method selection
Choose what and how to delete

The Action is based on an AppleScript script, the deletions are done via the command line tools rm, srm, xattr and find. Pretty trivial, nothing you couldn’t do in the Terminal also. But not as comfortable.1

But beware, during debbuging I’ve deleted almost my entire Applications folder by accident. That’s why I implemented some basic safety:

  • It asks for confirmation before deleting anything
  • You can choose to use it either in “safe” mode (deletes only files) or in full mode (deletes also folders and folder contents, recursively). For details please see the ReadMe.
  • It gives you an instant report, listing the deleted items and any errors
  • It writes a log file
Deletion report
After action report

For a detailed decscription see the ReadMe.

Download (1.1.1 / 2016-07-01)

The Action is code-signed. You can verify the integrity by activating “Allows actions from identified developers only” in Launchbar Index → Actions → Options. Use it at your own risk! In case of any problems feel free to post a comment below.


Sources, Credits, More Info

Changes
1.1.1 (2016-07-01)
Fixed: Path to tmp file
1.1.0 (2015-03-04)
Added: Delete Metafiles '.DS_Store' and 'Icon?' (recursive and non recursive)
Added: Delete Empty Folders
Changed resource fork deletion method to avoid errors from folders in path
1.0.1 (2015-02-20)
Initial release

Footnotes

  1. In OS 10.11 (El Capitan) Apple has added a “Delete Immediately…” command to the Finder. You can execute it by typing ⌥⌘⌫ (opt-cmd-backspace) and you’ll also find it in the Finder’s File menu while holding down the option key. The command is also useful for deleting individual items in the Trash, without the need to empty the whole Trash. See my in-depth post.

9 thoughts on “LaunchBar Action: Delete”

  1. I get this error when I try to use the action:

    Error -43: File file Mac HD:tmp:LB_Delete_Action.tmp wasn’t found. (Range: 0, 0) (Application: LaunchBar AppleScript Runner).

    Is this action’s source code on github?

    OS X 10.11.3
    Launnchbar 6.4

    1. I cannot reproduce this error. How did you install it? (It should install with a double-click from the .dmg.)
      However, here the action is launching correctly but then it demands for text input (which it shouldn‘t); a new/different problem… I’ll investigate and check back..

      No, the source is not on Git. No reason for that as the source is not compiled, i.e. you are free to modify it straight away. Just open the .lbaction bundle (right-click > Show Package Contents).

      Thanks for the message.

      1. I just double clicked the package, like it says. Tried to install it twice. The source on git would allow other people to fork, contribute to the action and report issues more easily.

        1. I just double clicked the package

          And you get the error -43 by double-clicking the package?

          The source on git would allow other people to fork, contribute to the action and report issues more easily.

          Yes, you are right. But I’m still building up this blog (i.e. trying to get some traffic) and putting things on GitHub would mean to deviate traffic. But as you can see I’m doing my best to respond to and to fix issues via the comments on this site. But at some point in the future I’ll put scripts and other sources on GitHub.

    1. I checked it again today and it still works as it did before. (The error I got yesterday was my fault: I had changed my Instant Send key and forgot about that.)

      The error you described means that the script couldn’t find the temporary file LB_Delete_Action.tmp. The script writes that file to /tmp/ and it contains the list of sent items.

      That probably means that it already fails when attempting to write the file. /tmp/ is a symbolic link that points to /private/tmp/. Could you check the permissions of /private/tmp/? Permissions should be drwxrwxrwt, owner root, group wheel. (On El Capitan.)

      You could also open the AppleScript file in the action bundle and change the path of the tmp file to a different location where you are sure to have read/write access. The path is set in property tmpFile (in the properties list at the beginning of the script).

  2. lrwxr-xr-x 1 root wheel 11 Oct 13 02:58 /tmp -> private/tmp/
    drwxrwxrwt 7 root wheel 238 Feb 17 16:38 /private/tmp

    1. Seems fine.

      Sorry, ATM I have no clue what is provoking the -43.

      Speaking about “sending a file to the delete action”: It’s not enough to select an item in the Finder and then invoke the delete action. You have to either use your “Instant Send” hotkey on a Finder-selected item, then invoke the Delete action – or select an item in LB’s file browser and then use the Tab key to send it to the action. But I guess you know this. Just to be sure.

    2. This error should be fixed now.

      Sorry for my massively delayed response 🙁
      (I had located the cause some months ago, but then somehow forgot to actually fix the Action!)

Leave a Reply

Your email address will not be published.