Skip to content

Instantly share code, notes, and snippets.

@loganhasson
Last active December 24, 2015 00:09
Show Gist options
  • Select an option

  • Save loganhasson/6714879 to your computer and use it in GitHub Desktop.

Select an option

Save loganhasson/6714879 to your computer and use it in GitHub Desktop.
Move to trash and empty trash from terminal
# 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