How to find all zero byte files in directory
How to find all zero bytes files in directory and even in subdirectories?
I did this:
#!/bin/bash
lns=`vdir -R *.* $dir| awk '{print $8"\t"$5}'`
temp=""
for file in $lns ; do
if test $file = "0" ;then
printf $temp"\t"$file"\n"
fi
temp=$file
done
...but I got only files in that directory, not all files, and if any file name had a space I got only the first word followed by a tab.
Can any one help me?
Solution 1:
find
is an easy way to do this-:
find . -size 0
or if you require a long listing append the -ls
option
find . -size 0 -ls