Add total MB free'd to output of 'remove-unused-sources' script.

This commit is contained in:
Jonathan Moore Liles 2008-12-06 00:29:07 -06:00
parent 193dc19c91
commit 5af2e2d73b
1 changed files with 19 additions and 4 deletions

View File

@ -56,9 +56,18 @@ set_diff ()
remove_sources () remove_sources ()
{ {
local TOTAL=0
local FILE local FILE
local SIZE
while read FILE while read FILE
do do
SIZE=`stat -c '%s' "${FILE}" 2>/dev/null`
if [ $? -ne 0 ]
then
echo "Would remove \"${FILE}\", if it existed."
else
if [ $DRY_RUN = yes ] if [ $DRY_RUN = yes ]
then then
echo "Would remove: ${FILE}" echo "Would remove: ${FILE}"
@ -66,7 +75,13 @@ remove_sources ()
echo "Removing unused source \"${FILE}\"..." echo "Removing unused source \"${FILE}\"..."
rm -f ./"${FILE}" ./"${FILE}-"*.peak rm -f ./"${FILE}" ./"${FILE}-"*.peak
fi fi
TOTAL=$(( $TOTAL + $SIZE ))
fi
done done
echo "...Freeing a total of $(($TOTAL / ( 1024 * 1024 ) ))MB"
} }
[ $# -gt 0 ] || fatal "Usage: $0 [--dry-run] path/to/project" [ $# -gt 0 ] || fatal "Usage: $0 [--dry-run] path/to/project"