#!/bin/bash # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Copyright (c) 2010 FSOCA final project | http://joaosantacruz.com # This script is licensed under GNU GPL version 2.0 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Create a BASH script (folder-usage.sh) to sort and display the files and folders of the # current directory in descending size. Extension: Ask the user whether they would like to sort # by file modification date or by size and then display the list. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - clear echo "= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =" echo " Folder Usage " echo "= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =" echo "" echo "Choose the order to list directory items" echo "1 - by modification date" echo "2 - by size" echo -e -n "\nOption: " read order if [ "$order" == "1" ] then ls -lrt elif [ "$order" == "2" ] then ls -lS fi echo "" echo "= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =" echo "Press [enter] key to continue. . ."; read pressedKey