Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

df equivolent in Perl

by Steve_p (Priest)
on Jun 25, 2002 at 22:33 UTC ( [id://177225]=perlquestion: print w/replies, xml ) Need Help??

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

I'm working on a script that will monitor the percentage of disk used on a UNIX filesystem. I probably will use `df` if I have to, but I'd prefer an all Perl solution. I've done some hunting for a Perl module that will do it for me, but I've come up with nothing so far. Does anyone know of a module in CPAN (or one that is already installed by default) that will give me this information?

Replies are listed 'Best First'.
Re: df equivalent in Perl
by grinder (Bishop) on Jun 25, 2002 at 22:39 UTC
    There is a (semi) pure Perl solution on CPAN named Filesys::Df. rob_au mentioned it to me the other day and I've been very pleased with it. I have found a bug in it, in that it gets hopelessly confused about the size of an NT drive mounted via NFS on a Solaris box (although it's not enough to worry me). But as far as the local filesystem goes it is spot on.


    print@_{sort keys %_},$/if%_=split//,'= & *a?b:e\f/h^h!j+n,o@o;r$s-t%t#u'
Re: df equivalent in Perl
by cjf (Parson) on Jun 25, 2002 at 22:36 UTC
      I would concur strongly with the comments of cjf directing attention to the Filesys::Df module which implements disk space checking via a statvfs call (via XS code within the Filesys::Statvfs module) - An example of usage of this module can be found on this site here.

      This module however is not wholly portable to Windows platforms, for which, the module Win32::AdminMisc may be more appropriate - See here for an example of this module in usage.

       

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://177225]
Approved by grinder
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (2)
As of 2025-04-24 19:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.