Hi Thomas , All

I'm not sure if a module exists to determine the folder size but this can
easily be done by recursing the directory structure and adding up the size
of the files it contains.

To ease up on the recursing task , File::Find comes in mighty handy.

$directory = 'C:\Perl';
$size = GetFolderSize($directory);
print "$size";

sub GetFolderSize
{
use File::Find;

my $FolderPath = shift;
my $FolderSize = 0;
find(sub {$FolderSize += -s $_}, $FolderPath);
return $FolderSize;
}

Just put this subroutine "GetFolderSize" in your script , use it as shown
above and voila ! :)

-aman.
A silly answer is one not given...


-----Original Message-----
From: Thomas Browner [mailto:thomas.browner@;digidyne.com]
Sent: Friday, November 08, 2002 8:56 PM
To: [EMAIL PROTECTED]
Subject: folder size


Can some one tell me how to get the folder in perl. I will getting this
from windowns nt.

 

Thomas 

 


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

Reply via email to