SharedTutor | Tutorials For Everyone

Find your interesting tutorials in Get your tutorial about Computer, Blogging, Makemoneyonline, Games, Design, and more!

How to Add a Delete Option to the Context Menu in Mac

automator-delete-option-thumbIf you are a Mac user, you will be aware that it doesn’t lets you permanently delete files through the context menu. There is only an option “Move to Trash” that move your file for the trash and you've got to manually empty the trash to delete the file. Wouldn’t you choose great if you possibly could add a “Delete” option in the context menu in order to quickly and easily delete the file/folder?

In terminal, we can easily easily delete (or remove) a file or folder while using command “rm“. Coupled with all the “-rf” flag, we can get the system to forcefully delete personal files or folder without prompt. In this tutorial, I will explain to you how you can make use of this command, in addition to Automator, to put in a “Delete” option towards the context menu.

1. Open Automator and select “Services”.


2. At the top of the correct pane, select “files or folders” in “Finder”.


3. On the left most pane, select “Utilities” and drag the “Ask for Confirmation” option towards the workflow. Enter the message to exhibit up within the confirmation dialog.


4. Next, drag “Run Shell Script” for the workflow. Change the “Pass input” field to “as arguments”.


Paste the next lines in to the shell script body:

for f in "$@" do rm -rf "$f" done   afplay "/System/Library/Components/CoreAudio.component/Contents/SharedSupport/SystemSounds/finder/empty trash.aif"

5. Lastly, save the service using the name “Delete”.


That’s it. Now when you right visit any file or folder, you ought to see a “Delete” option. Select it and it will delete the file/folder.

Binding a shortcut step to Delete file

An additional thing you can do with this newly created “Delete” service is to bind a keyboard shortcut with it. You can then press the shortcut answer to quickly delete the file.

1. In Finder, head to “Finder -> Services -> Services Preferences” in the menu bar. Locate the “Delete” option, select it and select “Add shortcut”.


2. Once you have set your shortcut key, you can press it once you've selected the file(s) and this will delete the selected file(s).


No comments

Post a Comment