Dan Cox wrote at Sat, 17 Aug 2002 09:47:33 +0200:

> I just realized that my earlier post could be misinterpreted. I'm trying
> to find out how to get a folder's size in bytes or MB's. My earlier post
> could have been interpreted as a LDAP directory. I hope this is an easy
> problem to solve. Thanks for the help.

Here's a solution that sums the sizes of all files in this folder and 
its subfolders.

use File::Find;

my $dirsize;
find(sub {$dirsize += -s if -f}, "./");

print $dirsize;


However, that won't give you the real size of a directory,
as a 1 byte file need more space than 1 byte, directories need some space,
and many more things. That's very system relevant.
On Unix, I'd better ask `du`.


Best Wishes,
Janek


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to