Operating System - HP-UX
1833769 Members
2322 Online
110063 Solutions
New Discussion

Has anyone written a Filesystem Summation Tool - listing Aging and sizes of Files?

 
Alzhy
Honored Contributor

Has anyone written a Filesystem Summation Tool - listing Aging and sizes of Files?

Or does anyone know of any publicly available binary or tool? I have a requirement to make a study/sumamry of our megazillion filesystems to know :

1.) Average sizes of files or distibution, etc..
2.) Aging - i.e number and total size of files meeting certain aging criteria, etc.

Perl or C source perhaps?
Hakuna Matata.
4 REPLIES 4
Steven E. Protter
Exalted Contributor

Re: Has anyone written a Filesystem Summation Tool - listing Aging and sizes of Files?

Shalom,

Buried in here are a number of possible tools.

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=51050

Yes you may need to read through 300 posts and the source code you choose, but there is probably a SOLUTION in one of the three threads associated with the link above.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Geoff Wild
Honored Contributor

Re: Has anyone written a Filesystem Summation Tool - listing Aging and sizes of Files?

For a directory...

a) total number of files in a directory
b) total size of all files
c) average filesize


ls -l | awk '$6{b+=$5;a+=1}END{print a,b,b/a}'


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Arturo Galbiati
Esteemed Contributor

Re: Has anyone written a Filesystem Summation Tool - listing Aging and sizes of Files?

Hi Nelson,
you can use this script as start ponit and expand it according to your needs:

#!/usr/bin/ksh
StsDir=${1:-.}
echo "DirCnt\tFileCnt\tSize Kb\tDirectory"
{
find $StsDir -type d | while read DirNam ;do
FilCnt=$(ls -lA "$DirNam" | grep ^- | wc -l)
DirCnt=$(ls -lA "$DirNam" | grep ^d | wc -l)
echo "$DirCnt\t$FilCnt\t$(du -ks "$DirNam")"
done
} 2>/dev/null | sort -nrk3
#eof

HTH,
Art
dirk dierickx
Honored Contributor

Re: Has anyone written a Filesystem Summation Tool - listing Aging and sizes of Files?

baobab, it's a part of gnome, but can work independent. this is a graphical tool, and not command line based though.

http://www.marzocca.net/linux/baobab.html