I am writing a bash script to find out all the files in a directory which are empty. I am running into multiple issues. I will really appreciate if someone can please help me.
#!/bin/bash
DATE=$(date +%m%d%y)
TIME=$(date +%H%M)
DIR="/home/statsetl/input/civil/test"
Logfile="$DIR/log/log_filesize_$DATE_$TIME.log"
d=0
f=0
#i=1
count="'ls C.RA.VCCXXXX.* -1|wc -l'"
echo "$count"
until [$count -lt 1 ];
do
for filename in '-s $DIR/C.RA.VCCXXXX.*'
do
if [ -s "$filename" ] ; then
let d=d+1
#d++;
else
let f=f+1
mail -s 'Empty File' xxxxx@xxxxxx.com
#f++;
fi
done
let count=count-1
done
echo $d" files have greater than zero length"
echo $f" files have zero length"