$| = 1;
iter_dir('C:\\');
sub iter_dir {
my $dir = shift;
my $D;
opendir($D, $dir);
my @f = readdir $D;
close $D;
for my $f(@f){
next if $f eq '.' || $f eq '..';
my $full = $dir .$f;
if (-d $full) {
iter_dir($full . '\\');
next;
}
if ($f=~/\.(txt|xml\cache)/) {
print "$full\n";
}
}
}
温馨提示:答案为网友推荐,仅供参考