while (1) { rewinddir(DIR); foreach my $file (grep -f, map "$dir/$_", readdir DIR) { GoProcess($file); } sleep 30; }