How To: Add a "Permanently Delete" Option to Context Menus to Skip "Move to Trash"

Massie

Well-known member
Feb 9, 2010
5,063
332
83
Visit site
How To: Add a "Permanently Delete" Option to Context Menus to Skip "Move to Trash"

Anyone who grew up on PCs will be familiar with the old Shift+Delete trick?that combination of keystrokes that immediately and permanently nukes a file. For many, it's a surprise to find that OS X doesn't offer that functionality without cumbersome Terminal commands or third-party apps. Instead, you must first move a file to Trash, and then "empty" the Trash. Only then is a file truly gone?along with everything else in your Trash.

But what if you only want to delete a particular file at a given time? With Automator, you can add the functionality to your context menus ("right-click" menus) using the Services workflow.

You can create an Automator service or application to facilitate executing the rm shell commando, which will permanently delete files or folders and skip the trash.

To begin, start by creating a new Service in the Automator app.

Select "files or folders" as input; you may also want to limit the availability of this service to the Finder app.

Optional?but highly recommended to prevent accidental deletion?is the addition of an Ask for Confirmation step to the workflow. Drag it into your workflow from the column at left, then customize the message and the Cancel and OK buttons to your liking.

Finally, add the Run Shell Script step to the workflow, again dragging from left. Make sure to pass input "as arguments". Then you can put in the following script:

for f in "$@"
do
rm -rf "$f"
done

To complete the process with a bit of audio confirmation, add the OS X "emptied trash" sound by including the following command at the end of the shell script:

afplay "/System/Library/Components/CoreAudio.component/Contents/SharedSupport/SystemSounds/finder/empty trash.aif"

Save your service, and it should be ready to use in Finder from the Services menu in the menu bar. You can also configure a keyboard shortcut to your service in the Keyboard preference pane of System Preferences.

Source/Screenshots : mountain lion - How can I skip the Trash when deleting a file? - Ask Different
 

Just_Me_D

Ambassador Team Leader, Senior Moderator
Moderator
Jan 8, 2012
59,786
647
113
Visit site
Re: How To: Add a "Permanently Delete" Option to Context Menus to Skip "Move to Trash"

Thanks, Massie...:)
 

Trending Posts

Members online

Forum statistics

Threads
260,379
Messages
1,766,627
Members
441,239
Latest member
smitty22d2