tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* SUMMARY: How to get disk usage
@ 1998-09-29  0:10 Dion Rivera
  0 siblings, 0 replies; only message in thread
From: Dion Rivera @ 1998-09-29  0:10 UTC (permalink / raw)
  To: tru64-unix-managers

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1998-09-29  0:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-09-29  0:10 SUMMARY: How to get disk usage Dion Rivera

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox