Last active
December 24, 2015 00:09
-
-
Save loganhasson/6714879 to your computer and use it in GitHub Desktop.
Move to trash and empty trash from terminal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # USE: trash <filename or dirname> | |
| function trash () { | |
| mv $1 ~/.Trash/$1 > /dev/null | |
| } | |
| # USE: empty | |
| function empty () { | |
| pushd ~/.Trash > /dev/null | |
| tmp=$(rm -rfv * | wc -l | sed -e 's/^[ \t]*//') | |
| if [ $tmp == "1" ]; then | |
| echo "$tmp file was removed." | |
| else | |
| echo "$tmp files were removed." | |
| fi | |
| pushd > /dev/null | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment