Thursday 29 March 2018

Shell script to display files of size greater than the specified size

#Display files of size greater than the specified size
echo "Enter size"
read size
for i in *
do
    if [ -f $i ]
    then
          s=`ls -l $i|tr -s ' '|cut -d ' ' -f5`

          if [ $s -gt $size ]
          then
              echo $i
          fi
    fi
done


OUTPUT
csc@csc-SVE1513CYNB ~ $ sh fsize.sh
Enter size
286
Firefox_wallpaper.png
a.out
archive.tar
arrsort.sh
drdl.sh
grp.c
logcnt.sh
occur.sh
oddeven02.sh
palin.sh
present.sh

No comments:

Post a Comment