opendir (FUL, "fullset") or die("fullset does not exists\n"); #open the fullset directory my @full= grep /000/, readdir(FUL); #reading fullset folder my @final =(); my @tfin =(); my $total1=''; my $whole=''; my $size=''; my $total=''; my $megs=''; my $s; do { my $TotalSize=''; $f1 = shift @full; my @t = "$cd\/fullset\/$f1"; sub find(&@) { &File::Find::find } *name = *File::Find::name; find { $size=-s($name); $TotalSize+=$size; } @t; my $megs = sprintf "%5.2f",($TotalSize/(1024*1024)); $total=$total + $megs; if($total <= 179) { push (@tfin, $f1); } if (($total <= 195) &&($total > 179)) { push (@tfin, $f1); push (@final, @tfin); print "$total\t@final\n"; $hash{$mfname.$mfold++}= [@final]; @tfin =(); @final =(); $total=0; $megs=0; } if ($total > 195) { push (@full, $f1); $total = $total - $megs; } }until (@full<= 4); $hash{$mfname.$mfold++}= [@tfin];#for the last split @sparr = splice(@full, 2, 2);#split last four into two $hash{$mfname.$mfold++}= [@full];# $hash{$mfname.$mfold++}= [@sparr];# #print "@{$hash{$_}}\n" for (keys %hash);