Dan Muey wrote: > >> On Tuesday, Nov 18, 2003, at 09:20 US/Pacific, Dan Muey wrote: >> >> > Howdy group. >> > >> > I have a need to get the size of a directory. >> > I could just execute unix's du command (my $sz = `du -sh >> /usr`;) but >> > was wondering if there's a better way to do it that is more >> portable. >> > I looked on cpan but didn't see anythign that jumped out at me. >> >
[snip] > Thanks. What I really want to do is avoid system commands completely. good decision. > I could always traverse the directory adding the size of each file > together and do that all in Perl with no system commands but I figured > there'd already be a Module or something like this, so I want to do it > that way. Somthign like: > > my $sz = $module->size("/home/joemama"); try Filesys::DiskFree #!/usr/bin/perl -w use strict; use Filesys::DiskFree; my $h = Filesys::DiskFree->new; $h->df; $h->device('/usr'); print "/usr has ",$h->avail('/usr')," bytes available\n"; __END__ prints: /usr has 111111111 bytes available david -- s,.*,<<,e,y,\n,,d,y,.s,10,,s .ss.s.s...s.s....ss.....s.ss s.sssss.sssss...s...s..s.... ...s.ss..s.sss..ss.s....ss.s s.sssss.s.ssss..ss.s....ss.s ..s..sss.sssss.ss.sss..ssss. ..sss....s.s....ss.s....ss.s ,....{4},"|?{*=}_'y!'+0!$&;" ,ge,y,!#:$_(-*[./<[EMAIL PROTECTED],b-t, .y...,$~=q~=?,;^_#+?{~,,$~=~ y.!-&*-/:[EMAIL PROTECTED] ().;s,;, );,g,s,s,$~s,g,y,y,%,,g,eval -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]