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?
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 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>
$ is ⇧⌦ (where ⌦ is Mac forward delete / Windows delete). ⇧⌫ would be
$ (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.
If a two-step keyboard process is acceptable, you could always do:
⌘ + ⌫ to move the file to the Trash
⌘ + ⇧ + ⌫ 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.
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.
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 ;-)
Now there is a better way to achieve 'permanent delete' functionality as specified by Matt Sephton in comment to this answer - Just use command + alt (option) + backspace. Thanks to him for the update.