bash-util/scripts/pacpruner-calculator

19 lines
405 B
Text
Raw Normal View History

#!/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";'