I'd do something like this (in ksh):-
Code:
foundc=0
nfoundc=0
for file in $FILELIST
do
if [[ -s "${file}" ]];then
# file is found and is > 0 bytes.
foundc=$(( found + 1 ))
...do something else you want...
else
# file is not found or is 0 bytes
nfoundc=$(( nfounc + 1 ))
...do something else you want...
fi
done
print "number of files in [$FILELIST] found = [${foundc}]\n"
print "number of files in [$FILELIST] NOT found = [${nfoundc}]\n"
You can change the -s test for -r (file is readble) -e (file exists) -d (file is directory etc) as you see fit.