Skip to content

Instantly share code, notes, and snippets.

@franklinharvey
Forked from emotality/force_empty_trash.sh
Last active August 19, 2018 02:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save franklinharvey/074151c36fff113414fc185c63c3862c to your computer and use it in GitHub Desktop.
Save franklinharvey/074151c36fff113414fc185c63c3862c to your computer and use it in GitHub Desktop.
Force empty Trash after placing Time Machine backups in trash, for all volumes in OSX (including connected drives).
#!/bin/bash
#### Created by Jean-Pierre Fourie
#### Editted by Franklin Harvey
### https://github.com/emotality
### https://github.com/franklinharvey
## force_empty_trash.sh
#
clear
echo " "
echo " ####################################################### "
echo " ################## FORCE EMPTY TRASH ################## "
echo " ####################################################### "
echo " "
echo " ** Note: This will permanently delete all your volumes' Trash, along with Time Machine Backups that are in Trash. **"
echo " "
read -p " Force empty all your Trash? [y/n]: " answer
case "$answer" in
y|Y ) sudo /System/Library/Extensions/TMSafetyNet.kext/Contents/Helpers/bypass rm -rfv /Volumes/*/.Trashes;;
n|N ) echo "Exiting \n"; exit;;
* ) echo "Exiting \n"; exit;;
esac
echo " Your Trash has been emptied! \n"
killall Dock
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment