Next | Program Repair Shop | 209 |
The day after I wrote this section, the following example appeared in clp.misc:
Subject: Quicker way to loop through directories? Message-ID: <9q1f65$ht6@newton.cc.rl.ac.uk>
if(opendir(DIR, "f:/list-logs")) { while($dir = readdir(DIR)) { if(-d "f:/list-logs/$dir" and $dir ne "." and $dir ne "..") { if(opendir(SUB, "$listlogs/$dir")) { while($file = readdir(SUB)) { if($file =~ /\.log.+/i) { $total += -s "$listlogs/$dir/$file"; } } closedir(SUB); } } } closedir(DIR); }
Wowzers!
Next | Copyright © 2002 M. J. Dominus |