[NEW] pacpruner: Added pacman pruner script and usage calculator

This commit is contained in:
Andrew Rogers 2023-06-24 03:57:50 -05:00
commit d6a5fe58e5
2 changed files with 104 additions and 0 deletions

18
scripts/pacpruner-calculator Executable file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env bash
read -d '' usage <<EOUSAGE
This script calculates the amount of space (in kibibytes) taken by the files
referenced in a newline-delimited listing.
USAGE: $0 FILE_LIST
EOUSAGE
. "$(dirname $0)/util/logging.bash"
[ -z "$1" ] && dedcat "$usage"
read -d '' PERL <<EOPERL
print $(cat "$1" | xargs du | awk '{print $1}' | tr $'\n' '+' | sed 's/+$//')
EOPERL
perl -e "$PERL"' . "\n";'