From ce695cd672ef4b24ac171df7d12c11648ca64cd9 Mon Sep 17 00:00:00 2001 From: Wirawan Purwanto Date: Mon, 3 Oct 2022 15:35:30 -0400 Subject: [PATCH] * Created initial tool to scan user dirs for the size of their trash folders. --- storage/inspect-trash-usage.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 storage/inspect-trash-usage.sh diff --git a/storage/inspect-trash-usage.sh b/storage/inspect-trash-usage.sh new file mode 100755 index 0000000..5499564 --- /dev/null +++ b/storage/inspect-trash-usage.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +mkdir -p -m 0700 /tmp/inspect-trash-usage + +Count=0 + +cd /home +for TD in /home/*/.local/share/Trash; do + DU_FILE=/tmp/inspect-trash-usage/trash-disk-usage.txt + TU=$(echo "$TD" | sed -e 's|^/home/||; s|/.*$||g') + if grep -w "/home/$TU" "$DU_FILE"; then + continue + fi + echo -n "$TU : " >&2 + time du -s "$TD" > "$DU_FILE.out1" + cat "$DU_FILE.out1" >> "$DU_FILE" + cat "$DU_FILE.out1" + if ((Count > 200)); then + break + fi + ((++Count)) +done