Bash script to find the number of files and identify which ones are 0 bytes.

view full story

http://www.unix.com – 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. Code: #!/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 Fil (HowTos)