1

Just change/add/remote the pathOfTrash variables. Then call the script from your Geeklet.

#!/bin/sh
#
pathOfTrash[0]="/Users/myusername/.Trash"
pathOfTrash[1]="/.Trashes"
pathOfTrash[2]="/Volumes/Drobo TimeCapsule/.Trashes"
pathOfTrash[3]="/Volumes/RAID Storage/.Trashes"

diskUsageCommnd=$(du -sckh /Volumes/*/.Trashes ~/.Trash/)
trashSize=$(echo $diskUsageCommnd | egrep -o '([0-9\.GMBK]+)\stotal' | head -n1 | egrep -o '([0-9\.GMBK]+)')
totalFiles=0
for i in "${pathOfTrash[@]}"
do
    :
    filesInFolder=$(find "$i" -type f | wc -l)
    folderName="${i/.Trashes/}"
    folderName="${folderName/.Trash/}"
    if [ $filesInFolder -gt 0 ]
    then
    if [ $filesInFolder -gt 1 ]
    then
        echo $filesInFolder "files in" $folderName
    else
        echo $filesInFolder "file in" $folderName
    fi
else
    #echo "No files in" $i
    zippo=0
fi
totalFiles=$(($filesInFolder+$totalFiles))
done

if [ $totalFiles -gt 0 ]
then
if [ $totalFiles -gt 1 ]
then
    itemName="Items"
    totalName="that are"
else
    itemName="Item"
    totalName="that is"
fi
echo "A total of" $totalFiles $itemName $totalName $trashSize
else
echo "Trash is empty!"
fi

`


Geeklet files to download

Comments

Log in to comment or register here.