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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.