#Delete files of size zero in the current directory
for i in *
do
if [ -f $i -a ! -s $i ]
then
echo "File $i size is zero"
rm -i $i
fi
done
OUTPUT
csc@csc-SVE1513CYNB ~ $ sh rmzerofile.sh
File 'hello' size is zero
rm: remove regular empty file ‘hello’? y
File 'well' size is zero
rm: remove regular empty file ‘well’? y
for i in *
do
if [ -f $i -a ! -s $i ]
then
echo "File $i size is zero"
rm -i $i
fi
done
OUTPUT
csc@csc-SVE1513CYNB ~ $ sh rmzerofile.sh
File 'hello' size is zero
rm: remove regular empty file ‘hello’? y
File 'well' size is zero
rm: remove regular empty file ‘well’? y
No comments:
Post a Comment