Many thanks for the info John.
I knew I was missing something obvious.
Enjoying learning Perl immensely!
 -Ed
On Tuesday 13 February 2007 00:39, John W. Krahn wrote:
> Ed wrote:
> > Hi all,
> 
> Hello,
> 
> > I am having problems with the difference in output between du from bash and 
> > du 
> > from Filesys::DiskUsage.
> > 
> > I wrote this little file to demonstrate my problem.  I am very new to perl 
> > so 
> > please forgive me if it's a silly mistake :)
> > 
> > file:
> > #!/usr/bin/perl -w
> > 
> > use Filesys::DiskUsage qw/du/;
> > 
> > system "du -sb /home/jdoe/perl";
> > system "du -sk /home/jdoe/perl";
> > $tot=du ( { 'sector-size' => 1024 } , { 'human-readable' => 1 } , 
> > qw/\/home\/jdoe\/perl/ );
> > print "\n$tot\t/home/jdoe/perl\n";
> > 
> > output:
> > 7597    /home/jdoe/perl
> > 20      /home/jdoe/perl
> > 
> > 6144    /home/jdoe/perl
> > 
> > Why can I not get the same values?  I have played around with:
> > { 'sector-size' => 1024 }
> > { 'human-readable' => 1 }
> > { 'Human-readable' => 1 }
> > { recursive => 1 }
> > ... but not one of them seems to give me the same value as the one I get 
> > from 
> > the shell.
> 
> The difference is because du includes the directory sizes in the total while
> Filesys::DiskUsage::du does not.
> 
> 
> 
> John
> -- 
> Perl isn't a toolbox, but a small machine shop where you can special-order
> certain sorts of tools at low cost and in short order.       -- Larry Wall
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to