Re: Create a list of files in a directory (recursively)
[email protected] ("John W. Krahn")
| Newsgroups | perl.beginners |
|---|---|
| Message-ID | <[email protected]> |
moroshko wrote:
> Hello experts !
Hello,
> What is the most efficient way to get a list of all file names (a full
> path) in a certain directory ?
> This should work recursively and include only files (not directories).
use File::Find;
my @all_file_names;
find sub {
return if -d;
push @all_file_names, $File::Find::name;
}, '/certain/directory';
for my $path ( @all_file_names ) {
print "$path\n";
}
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall