Gossamer Forum
Home : General : Perl Programming :

Directory Scrip

Quote Reply
Directory Scrip
I would like to display all directories found on my site and the total file space used in each directory. Is there an easy way to do that? The more I think about the logic looping through multiple sub-levels of directories, I get dizzy! :)

Output would look similar to:

/ 1234
/cgi-bin 534
/data 55337
/data/stats 227

and so on. The root directory may change, so the top-level directory needs to be a variable.

Thanks again for any guidance anyone may offer.
Quote Reply
Re: [Lee] Directory Scrip In reply to
on a *nix system with du (see: man du), you could use that to create what you need.
for example:
brewt@munky:/www/docs$ du -h
796k ./apache/mod
136k ./apache/howto
68k ./apache/images
472k ./apache/misc
96k ./apache/programs
12k ./apache/search
152k ./apache/vhosts
2.4M ./apache
5.3M ./vim
7.7M .

or
brewt@munky:/www/docs$ du /www/docs
796 /www/docs/apache/mod
136 /www/docs/apache/howto
68 /www/docs/apache/images
472 /www/docs/apache/misc
96 /www/docs/apache/programs
12 /www/docs/apache/search
152 /www/docs/apache/vhosts
2448 /www/docs/apache
5400 /www/docs/vim
7852 /www/docs


Adrian