Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I would like to delete and permanently delete a file in finder using del and shift+delete (windows style).

Is there any way to remap this in OS X lion?

share|improve this question
2  
Why? What is wrong with command-delete? –  Abhi Beckert Mar 24 '12 at 9:56
1  
See this question SU. You can also always use the terminal and rm. –  Linuxios Aug 13 '13 at 16:57
    
@Linuxios Very good find :) –  Simon Aug 13 '13 at 17:01
    
Sure. SU usually has better answers for these power user questions than the "consumer" oriented sites (Ask Different, Ask Ubuntu, etc.). –  Linuxios Aug 13 '13 at 17:03
    
@Linuxios I thought that SU was supposed to be alot less Apple flavoured than AskDifferent ? –  Simon Aug 13 '13 at 17:05

4 Answers 4

If you want to delete files immediately, you can copy the files, open Terminal or iTerm, type rm -r ‌ and press ⌘V.

If you want to delete the files securely so that they cannot be recovered with an application like DiskWarrior or DataRescue, you can use srm -srf. srm uses the 35-pass Gutmann algorithm by default, but -s only overwrites files with a single pass of random data.

You could also create a service like this:

osascript -e 'on run argv
    set text item delimiters to linefeed
    tell application "Finder"
        display dialog "Delete the following files immediately?" & linefeed & linefeed & text items of argv
    end tell
end run' "$@"
[[ $? != 0 ]] && exit 0
rm -rf "$@"

I didn't use an Ask for Confirmation action, because it can't be used to display the paths specified as arguments, and the dialogs shown by it don't get keyboard focus.

The service cannot be used to delete a file if deleting it would require superuser privileges.

You can give the service a keyboard shortcut from System Preferences > Keyboard > Keyboard Shortcuts > Services. The shortcut recorders don't allow entering ⇧⌦ as a keyboard shortcut, but you can first give the service some temporary shortcut, then close the System Preferences window, then run something like f=~/Library/Preferences/pbs.plist; plutil -convert xml1 $f; open -e $f, and then change the key equivalent to $:

<key>(null) - Delete Immediately - runWorkflowAsService</key>
<dict>
    <key>key_equivalent</key>
    <string>$&#xU007F;</string>
</dict>

$&#x007F; is ⇧⌦ (where ⌦ is Mac forward delete / Windows delete). ⇧⌫ would be $&#x0008; (where ⌫ is Mac delete / Windows backspace). The format used for the shortcut strings is described in http://lri.me/keybindings.html.


As for making ⌦ (Mac forward delete / Windows delete) move files to the trash, you can modify Finder's property list:

defaults write com.apple.finder NSUserKeyEquivalents -dict 'Move to Trash' '\U007F'
killall Finder

However that also makes pressing ⌦ move a file to the trash when you are renaming a file.

share|improve this answer
    
If only your answer would only consist of that last sentence ;-) –  Asmus Mar 24 '12 at 11:08
    
after reading the last line ... this approach is almost useless unless we have a workaround for using delete in renaming the file –  Riyaz Mohammed Ibrahim Mar 26 '12 at 4:46

If a two-step keyboard process is acceptable, you could always do:

+ to move the file to the Trash

then

+ + to empty the Trash (with confirmation popup) or

+ + + to empty the Trash (without confirmation popup).

Obviously, that will also get rid of all the other files already in the trash.

Alternatively, maybe something like Trash X would help. The description says:

You can use it to instantly delete or shred file and folders without sending them to the trash. You can use it to empty or shred trash only on selected disks. And of course, you can use it just like the trashcan you've always had on your desktop.

share|improve this answer

What you can do is send the file(s) to trash, and then click Finder->Secure Empty Trash.

You can also make a keyboard shortcut to make that process a little quicker, as described in this article.

It's not exactly what you want, but seems to be the closest you can get without looking into creating something with Automator or Keyboard Maestro.

share|improve this answer
    
Nice article. What is Keyboard Maestro ? (perhaps a hyperlink to it in your answer if possible) –  Simon Aug 13 '13 at 17:06
    
Excellent, much appreciated :) –  Simon Aug 13 '13 at 17:08
    
I've added a link. It's an application that allows you to create various type of macros, or keyboard shortcuts, to do things quicker. You can create shortcuts to do some very complicated multi-step things. Probably overkill to buy for just this one task, though. –  David Aug 13 '13 at 17:10

I have made a simple app in cocoa, which acts like the trash icon but with different behaviour ie. when a file or folder is dropped on its icon in dock, it deletes it permanently.

I have also written a blog post about it- Mac OS X : shift + delete

Here is the link for the app- DeleteMe

Basic idea is - use: rm -rf , exactly the same what is suggested in the most voted answer, but implemented in a different way ;-)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.