Write a script to display the directory in the descending order of the size of each file.

clear

while true;do

echo -e “Enter the directory name ::\c”

read path1

[[ -d $path1 ]] && break

echo Invalid name

done

ls -s $path1/* > temp

sort -nr temp

rm temp

 

OUTPUT::

 

Enter the directory name ::a2

1 a2/abc

0 a2/a4

0 a2/a3

0 a2/a2

 

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.