Commit 6db0ce55 authored by Klaatu's avatar Klaatu
Browse files

pitched empty, made it a function within tras

parent bbbe3f24
#!/bin/sh
ARG="$1"
# empty - empty the contents of ~/.trash
#
# Copyright (C) 2011 Klaatu la Terible
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# seems silly to have a conf file for trash
# so im pulling in BASKET var from trashy script
#BASKET=$(grep -m1 BASKET $(which trash) | cut -f2 -d"=")
case "$(uname | tr [:upper:] [:lower:] )" in
linux|bsd|sun) BASKET=~/.local/share/Trash ;;
darwin) BASKET=~/.Trash ;; #check when around a mac
*) echo "cannot find your trash" && exit ;;
esac
# default action
ACT="find"
KILLER="-delete"
CHECK=$(ls $BASKET/files/ )
# is trash already empty?
if [ "X$CHECK" = "X" ]; then
RUBBISH="You have no files in trash."
else
RUBBISH="Pretending to remove: $CHECK"
fi
# process verbosity and dryrun options
if [ "$1" = "-v" -o "$1" = "--verbose" ]; then
VERBOSE=1
shift 1
elif [ "$1" = "-d" -o "$1" = "--dryrun" -o "$1" = "--dry-run" ]; then
echo $RUBBISH
echo "You chose --dry-run mode so nothing has been removed."
echo "Your Trash is currently $(du -h $BASKET | cut -f1 | tail -n -1) in size."
shift 1
else
find $BASKET -delete -mindepth 1
echo "Your trash is now empty."
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment