Mac OS X: force empty trash in command line

Sometimes, the Mac Trash cannot be emptied.
You can run the following two commands in Terminal to empty your Trash:
  • The following command will empty the Trash in the user's home directory:
    rm -fr ~/.Trashes/*
  • The follwoing command will empty the Trashes on all the hard drives, e.g. on the external usb hard drive:
    IFS=$(echo -en "\n\b"); for d in $(ls /Volumes); do rm -fr /Volumes/$d/.Trashes/$UID/*; done; unset IFS

No comments:

Post a Comment