From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96078721912154.tru64-unix-managers.marc@archive.invalid> From: Dion Rivera Date: Tue, 29 Sep 1998 00:10:57 +0000 To: tru64-unix-managers Subject: SUMMARY: How to get disk usage X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96078721912154 The following scripts was sent in by Simon Millard and works really well on getting stats you can use on a directory. Enjoy! and thanks Simon. Dion ## tool to display the number of directories, files and blocks from # a parent directory# PID=`ps | head -2 | tail -1 | awk '{print $1}'` OUTFILE=/tmp/filesysanal.$PID ls -a | tail +3 > $OUTFILE echo "Analysis of `pwd` - This may take some time"echo " " echo "Filename\t\t\tType\t Files\t1024K blocks" echo "========\t\t\t====\t =====\t=====" for i in `cat $OUTFILE` do TYPE=`file $i | awk '{print $2}'` case "$TYPE" in "directory") FILETYPE="DIR";; esac FILES=`find $i -print -type f | wc -l` BLOCKS=`du -sk $i | awk '{print $1}'` NAME=`echo $i | awk '{printf ( "%-25.25s", $1)}'` echo "$NAME\t$FILETYPE\t$FILES\t$BLOCKS" done rm $OUTFILE ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com