look into the find command.
man find,,, maybe you can hack some of this script,,,,,, it does not do what you want,, but i think parts of it does-------------------------- look down for the line with "find"
#!/bin/ksh
#
# $0 [-u userID] dir
#
if [[ $setx = "true" ]];then set -x;fi
U_f=false;
for i
do case $1 in
-u*) shift
U_f=true
U=${1};;
-h*) more<<*eof
------------------------------------------------------------------------------------
aha2231
Thu Aug 14 13:59:05 PDT 2008
This script will recursively report out if a file is on tape or if it is on disk
based on ls -s = 256
Usage: $0 [-u $USER ] directory
-u $USER will return only those files owned by $USER
directory requested is $1, or default to current directory
Ex: $0
$0 .
$0 dir
$0 -u $USER dir
------------------------------------------------------------------------------------
*eof
exit;;
-*\) echo "\\007illegal $0 option $1\\007"
$0 -h
exit;;
*\) break;;
esac
shift
done
if ${U_f} true; then
U="-user ${U}"
else
U=""
fi
echo USER $USER
echo NODE `hostname`
echo START `date`
dir=${1:-`pwd`}
find ${dir} ${U} -type f -ls | awk ' {
f1="ON %-4s %12.2f %-3s %-7s %-7s %5s %2s %-15s %1s"
flag=$2
s=$7
f=$11
u=$5
month=$8
day=$9
time=$10
group=$6
if(flag=="256" && s/1024 > 256 ) {
q="TAPE"
t[(substr($3,1,1))]++;tsum=tsum+$7
}
else {
q="DISK"
d[(substr($3,1,1))]++;dsum=dsum+$7
}
out1 = sprintf(f1, q, s/1024, "kb", u, group, month, day, time, f)
print out1
}
END{
print tsum/1024/1024/1024 " Gigabytes, and " t["-"] " files are ON TAPE"
print dsum/1024/1024/1024 " Gigabytes, and " d["-"] " files are ON DISK"
}'
exit