in reply to Disc Space checking

The script was designed to be called as a CGI script. It could be called by a form or simply by typing in http://yoursite.com/cgi-bin/scriptname.pl?pass=Tn9SG0s You can run it from the command line using ./script.pl pass=Tn9SG0s.

Anyway seeing you are on a *nix you could probably just do:

du -hs /home/*

For a bit more pizzaz try:

du -hs `du -bs /home/* 2>/dev/null |sort -nrk 1|head -20|cut -f 2`

Which will give you the sorted top twenty dirs (in /home in this example) with nice human readable sizes.

cheers

tachyon

Replies are listed 'Best First'.
Re^2: Disc Space checking
by gaal (Parson) on Sep 17, 2004 at 08:49 UTC
    Ew, that hits the tree twice :(

    On a big directory you'd probably want to put du's output in RAM and do the postprocessing there...

      Yes, but it only hits 20 indodes the second time around :-)

      cheers

      tachyon

        It can hit up to 60 depending on filesystem type and filename length, but yeah, come to thing of it, this isn't too bad :-)

        (Wait no, it can hit more than 60 actually, because subdirectories mean another inode hit (or three). So in very deep, very long cases, this can take a few hundred hits. Still not too bad in practical terms, of course.)