#! /bin/sh

#================================================================
# findsize
# Check total size of target files under a directory
#================================================================


# setting variables
LANG=C ; export LANG
LC_ALL=C ; export LC_ALL


# calculate size
sum=0
find . -type f -print | egrep '(\.txt|\.asc|\.html|\.htm|\.eml|\.mht)$' |
while read file
do
  num=`ls -l "$file" | tr -s ' ' | cut -d ' ' -f 5`
  sum=`expr $sum + $num`
  printf '%d\t%d\t%s\n' "$sum" "$num" "$file"
done


# exit normally
exit 0



# END OF FILE
