#!/usr/bin/ksh
#
# Size of selected files in a directory
#
typeset -R15 total
typeset -R15 size
typeset -R5 count
typeset -L25 fn
if (( $# != 2 )); then
print "Usage: $0
"
exit
fi
if [[ ! -d $1 ]] then
print "Eh? - $1 not a directgory"
exit
fi
parmDir=$1
parmSrch=$2
(( total = 0 ))
(( count = 0 ))
print "$(uname -n) - Selected Files ${parmSrch} under ${parmDir} - $(date)"
find ${parmDir} -name "${parmSrch}" -type "f" -print -xdev |\
xargs -I{} ls -l {} |\
awk '{print $5 " " $NF}' | while read line; do
size="$(print ${line} | awk '{print $1}')"
fn1="$(print ${line} | awk '{print $2}')"
fn="${fn1##*/}"
(( count = count + 1 ))
(( total = total + size ))
print "${count} ${size} ${fn} - RT ${total}"
done
print " "
print " Files Total Size"
print "${count} ${total}"