W.A.S.S to delete all such files from the system that have size zero.
Program
# W.A.S.S to delete all such files from the system that have size zero.
total=`ls -lSr | tr -s " "|cut -d " " -f5,9|wc -l`
total=`expr $total - 1`
for w in `ls -lSr | tr -s " "|cut -d " " -f5,9|tail -n$total|head -n1`
do
size=`ls -lSr | tr -s " "|cut -d " " -f5|tail -n$total|head -n1`
name=`ls -lSr | tr -s " "|cut -d " " -f9|tail -n$total|head -n1`
echo "$size $name"
if test $size = "0"
then
rm "$name"
echo "$name is deleted.."
else
exit
fi
total=`expr $total - 1`
done
Output
sh zsize.sh
0 zero.sh
zero.sh is deleted..
0 mbox
mbox is deleted..