Add summarize parameter to check-trash.

This commit is contained in:
Hyperling 2025-01-02 13:37:22 -07:00
parent 752969e2fa
commit 76ec891138

View File

@ -287,10 +287,13 @@
clean="Y" ;;
-n | -net | --network )
network="Y" ;;
-s | -sum | --summarize )
summarize="-s" ;;
* )
echo "
ERROR: Option '$1' with value '$2' not recognized.
$PROG [-c|-y|--clean] [-n|-net|--network]
$PROG [-c | -y | --clean] [-n | -net | --network] \
[-s | -sum | --summarize]
" >&2
return 1
;;
@ -318,8 +321,8 @@
echo "Checking $dir..."
$sudo find $dir -name TRASH | while read trash; do
if [[ "$trash" != "" && `$sudo ls -a $trash` ]]; then
echo "Found $trash with contents:"
$sudo du -ha $trash | sort -h
echo "Found $trash:"
$sudo du -ha $summarize $trash | sort -h
if [[ "$clean" == "Y" ]]; then
echo "Cleaning trash..."
$sudo sh -c "cd $trash; rm -rfv ..?* .[!.]* *"
@ -328,8 +331,8 @@
done
$sudo find $dir $maxdepth -name "*"Trash"*" | while read trash; do
if [[ "$trash" != "" && `$sudo ls -a $trash` ]]; then
echo "Found $trash with contents:"
$sudo du -ha $trash | sort -h
echo "Found $trash:"
$sudo du -ha $summarize $trash | sort -h
if [[ "$clean" == "Y" ]]; then
echo "Cleaning trash..."
$sudo sh -c "cd $trash; rm -rfv ..?* .[!.]* *"
@ -345,8 +348,8 @@
echo "Checking $dir..."
sudo find $dir -name TRASH | while read trash; do
if [[ "$trash" != "" && `sudo ls -a $trash` ]]; then
echo "Found $trash with contents:"
sudo du -ha $trash | sort -h
echo "Found $trash:"
sudo du -ha $summarize $trash | sort -h
if [[ "$clean" == "Y" ]]; then
echo "Cleaning trash..."
sudo sh -c "cd $trash; rm -rfv ..?* .[!.]* *"
@ -355,8 +358,8 @@
done
sudo find $dir -name .Trash"*" | while read trash; do
if [[ "$trash" != "" && `sudo ls -a $trash` ]]; then
echo "Found $trash with contents:"
sudo du -ha $trash | sort -h
echo "Found $trash:"
sudo du -ha $summarize $trash | sort -h
if [[ "$clean" == "Y" ]]; then
echo "Cleaning trash..."
sudo sh -c "cd $trash; rm -rfv ..?* .[!.]* *"