my $Size = best_convert( my $SizeUnit, $DirInfo->{HighSize}, $DirInfo->{LowSize}, ); print "Dir size = $Size $SizeUnit \n"; #### sub make_table(){ $table=$page3->Scrolled('HList',-columns=> 2,-header=> 1,-width=>31,-height=>9,-font=>"Times 12",-scrollbars=>'osoe') ->place(-x=> 280, -y=> 136); $table ->headerCreate(0, -text=>" Directory "); $table ->headerCreate(1, -text=>" Size "); open(BATCHIN, "){ chomp; @arraybatch = split ' '; #put each line in an array to use when I invoke the size calculation method foreach (@arraybatch){ my $cleansource = $source; $cleansource .= "\\"; $cleansource .= $_; #append the \\ and the user directory $sourceResult = dir_size($cleansource, $sourceDirInfo,);#get the size of the directory $sbyte += $sourceDirInfo->{DirSize}; #add the bytes of all of the directories $sourceSize = best_convert($sourceSizeUnit, $sourceDirInfo->{HighSize}, $sourceDirInfo->{LowSize},);#converts my $s = $sourceSize;#append the size $s .= $sourceSizeUnit;#appends the unit to the size $table->add($_); $table->itemCreate($_, 0, -text => $_); $table->itemCreate($_, 1, -text => $s); }#foreach }#while }#make_table #### #!/usr/bin/perl -w use strict; use Win32::DirSize; use integer; my $sourcesize="Total: "; my $sbyte=0; my $test = "C:/"; $test=~s/\//\\/g; print $test; my $Result = dir_size( $test, my $DirInfo, # this stores the directory information ); $sbyte = $DirInfo->{DirSize}; print "Dir size = $sbyte bytes\n"; if ($sbyte < 1024){ $sourcesize .= "$sbyte B"; print $sourcesize; } elsif (1024 <= $sbyte && $sbyte < 10240){ $sbyte=$sbyte/1024; $sourcesize .= "$sbyte KB"; print $sourcesize; }elsif (10240< $sbyte && $sbyte < 1073741824){ $sbyte=$sbyte/1048576; $sourcesize .= "$sbyte MB"; print $sourcesize; }else{ print "More than 3.99GB";}#else