ls -1 ${MyFile} >> ${dir_log}ListFile${Now}.tmp
FILENUM=`cat ${dir_log}ListFile${Now}.tmp| wc -l | awk '{print $1}'`>> /dev/null
if [ ${FILENUM} -lt 1 ]
then
writeError "ERRORE: no file in directory for type ${FileName}!" >> ${LogFileName}
Close 1
fi
Looking closer, the statement is dealing with filenames that end in .tmp and your error message is dealing with filenames that end in *.gz. So you are looking at the wrong statement. Maybe you need to put the redirect on the ls statement above it. Or more likely it's the wrong fragment of code entirely.