use Win32::DirSize;
open (FILE, "02_dir.txt") || die "can not open file\n";
chomp (@file = <FILE>);
close FILE;
$f = "d:\\programs";
#foreach $f (@file) {
dsize($f);
#}
sub dsize {
chomp (my $param = shift(@_)) ;
print "$param \n";
my $Result = dir_size(
$param,
my $DirInfo, # this stores the directory information
);
if ($Result == DS_RESULT_OK) {
# If you don't want to display results in bytes,
# let the module determine the best unit.
my $Size = best_convert(
my $SizeUnit,
$DirInfo->{HighSize},
$DirInfo->{LowSize},
);
print "Dir size = $Size $SizeUnit \n";
}
}
This does not work.
use Win32::DirSize;
open (FILE, "02_dir.txt") || die "can not open file\n";
chomp (@file = <FILE>);
close FILE;
#$f = "d:\\programs";
foreach $f (@file) {
dsize($f);
}
sub dsize {
chomp (my $param = shift(@_)) ;
print "$param \n";
my $Result = dir_size(
$param,
my $DirInfo, # this stores the directory information
);
if ($Result == DS_RESULT_OK) {
# If you don't want to display results in bytes,
# let the module determine the best unit.
my $Size = best_convert(
my $SizeUnit,
$DirInfo->{HighSize},
$DirInfo->{LowSize},
);
print "Dir size = $Size $SizeUnit \n";
}
}
|