tphyahoo has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks, my trial version of disk size manager just ran out.

"This program tracks your hard disk space, and displays the information with text, 2D and 3D pie and bar charts, and graphs. It can provide information about the folders and drives you indicate, including folder or drive space, number of files and drive cluster sizes. Disk The program includes a search tool, and you can specify search conditions."

I am wondering if there is some already written perl script to do this, obviously without the bells and whistles (bar charts, etc). Otherwise I may try and rustle up something along these lines myself, based on file::find.

But someone's got to already have done this.

Oh, it's got to work on windows.

Replies are listed 'Best First'.
Re: Disk size manager in perl?
by cog (Parson) on Aug 04, 2005 at 13:36 UTC
Re: Disk size manager in perl?
by hawtin (Prior) on Aug 04, 2005 at 14:06 UTC
      Looks useful, but I get an error (No hard drive) when I push the browse button. But regardless, makes me realize, I have to learn tk!
Re: Disk size manager in perl?
by davidrw (Prior) on Aug 04, 2005 at 13:59 UTC
    If you don't need to use perl and can use another stand-alone app, i recommend DiskData -- puts a context menu item in so you can launch by right-clicking a folder, and gives a nice bar char that makes it exteremely easy and fast to find what files/dirs are hogging space.
Re: Disk size manager in perl?
by bofh_of_oz (Hermit) on Aug 04, 2005 at 14:48 UTC
    Here's my script that works on Win32 computers. It uses Win32::DriveInfo to grab the stats, and logs them into a MySQL DB. (Ignore Net::MySQL stuff, DBI is better - but the script is old...)

    --------------------------------
    An idea is not responsible for the people who believe in it...

Re: Disk size manager in perl?
by Anonymous Monk on Aug 04, 2005 at 16:03 UTC
    People have done this, yes. Often part as larger system tracking tool. Mrtg for instance, or its successor (cricket?). HP Openview in combination with Crystal Reports does more than you want to know. And then there are a billion system administrators each rolling their own. No doubt some of it was written in Perl.

    I've used mrtg, HP Openview, Big brother, and a handful of solution written by myself to track disk (or rather, volume) usage. Some of it written in Perl. But also in C and shell/awk.

    But none of it was based on File::Find, or on find(1). Summing the sizes of files reported this way doesn't give you accurate information - hard links are counted twice, sparse files are counted for way too much, open, but deleted files are not counted at all, it's too easy to forget counting the size of a directory, and special files are a problem. And 1000 files of one character take a lot more space than a single file containing 1000 characters. Just ask your OS, or your volume manager how space is in use. And don't forget to record your inode usage - data blocks aren't the only thing that can cause a filesystem to fill up.