Not exactly, my solution (although badly worded that late at night) was to (in psudo code):
while (1) {
$totallistoffiles = glob all_dir_list/*;
fork
if child {
proccess file list
exit
}
else #parrent {
sleep 2
}
}
The parrents task is to grab the list of files (read all 20 directories) every x seconds fork and create a child that proccesses such list -- only to loop sleep and do it all over in x seconds. your only downside here is that the child has to (on average) execute faster than the sleep time of the parent otherwise you will slowly gain procs. I hope this clears it up.
-Waswas