Directly deleting files in OS X

In OS X, I’m so not used to having to send files to Trash first before emptying it, just to get rid of files I no longer want. In the end, I created an Automator service that does the job for me.

(File download at the bottom of this post)

How To Use

1. Select the files to delete, and right-click:

 

 

 

 

 

 

2. Confirmation Prompt:

 

 

Simple as that.

How It Is Done

Here is how it is done in Automator:

The guid in the text box of the “Ask for Confirmation” step is a hack to insert the file names into the prompt dialog (step 2 above). It is the guid of the variable “Files” in “Set Value of Variable”, obtained by opening the document.wflow file of this Automator service in a text editor and searching for it there. It is unfortunate that Automator doesn’t support variables in the text of the confirmation dialog.

So if the user clicks “Yes” to the dialog, the shell script will do our favourite rm -r on each file. Why “-r”? Because the file could be a folder too, which we delete -recursively.

Download and Install

The Automator Service bundle can be downloaded here: delete_Files_Mac.zip It is just a bunch of xml in a Mac bundle which you can freely examine in Automator or any text editor.

I don’t know if any install step is needed.

  • Unzip it and copy the app bundle to /Users/YourUserHome/Library/Services.
  • Try right-clicking on any unwanted files in Finder, and see if the “Delete File(s)” option appears at the bottom of the context menu.
  • If not, maybe try to open and save it via Automator and try again.

No Comments.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre lang="" line="" escaped="" cssfile="">