tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: Dion Rivera <dion_rivera () hotmail ! com>
To: tru64-unix-managers
Subject: SUMMARY: How to get disk usage
Date: Tue, 29 Sep 1998 00:10:57 +0000	[thread overview]
Message-ID: <96078721912154.tru64-unix-managers.marc@archive.invalid> (raw)

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

                 reply	other threads:[~1998-09-29  0:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

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