in reply to Recursive file search
sub loopDir { my @files; local ($dir) = @_; chdir $dir or die "Cannot chdir to $dir\n"; local(*DIR); opendir DIR, '.'; while ($f=readdir(DIR)) { next if $f =~ /^\./; push @files, $dir . '/' . $f if $f =~ /.*\.xml$/; if (-d $f) { # push the subdirectory's files onto @files push @files, &loopDir($f); } } closedir(DIR); chdir(".."); # return the list of files return @files; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Recursive file search
by merlyn (Sage) on Feb 20, 2005 at 04:24 UTC | |
by mellin (Scribe) on Feb 20, 2005 at 10:09 UTC |