2020-11-24 00:20:02 +01:00
|
|
|
#!/bin/sh
|
|
|
|
# shows size statistics for subfolders
|
|
|
|
# max depth is equal to the first argument if it is a number or 1
|
2023-02-07 13:19:34 +01:00
|
|
|
export chars=$(expr $(tput cols) - 60)
|
2023-11-07 10:58:02 +01:00
|
|
|
case "$1" in (+*) size=${1#+}G; depth=2; shift;; esac
|
2022-03-15 16:56:22 +01:00
|
|
|
case "$1" in ([0-9]) depth=$1; shift;; esac
|
2023-11-07 10:58:02 +01:00
|
|
|
(du --max-depth "${depth:-1}" -xhat ${size:-500M} "$@" | sort -h | grep -v "^0") |
|
2023-03-31 19:09:55 +02:00
|
|
|
while read line; do echo "$(tput smso)$line$(tput rmso) $(pacman -Qqo $(echo $line | awk '{print $2}') 2>/dev/null | paste -s -d',' | sed "s/\(.\{${chars}\}\).*/\1.../")"; done || #| column -t ||
|
2021-09-16 14:18:26 +02:00
|
|
|
(du --max-depth "${depth:-1}" -xha "$@" | sort -h | tail)
|