# count is the number of directoires (always even) # $here is used to iterate through the directories # sub wanted goes throught directory and does the copying # @directory has the list of directoires for($num = 0; $num < ($count-1)/2;$num++) { $here = $num; $pid = fork(); if($pid == 0) { $here++; print "1 about to find $directory[$here] : $here\n"; find({wanted => \&wanted},"$directory[$here]"); } else { if($here!=0){$here = $here+2;} print "2 about to find $directory[$here] $here\n"; find({wanted => \&wanted},"$directory[$here]"); } do{ $kid = waitpid(-1,&WNOHANG); }until $kid == -1; } exit(0);