Re: $File::Find and no_chdir
- From: krahnj@xxxxxxxxx (John W. Krahn)
- Date: Thu, 27 Sep 2007 04:50:44 -0700
schms wrote:
Hi,
Hello,
I have a UNIX directory $DIR which contains a lot of files and
subdirecotires. Now, I would like to list all files and
subdirectories in $DIR only. That means, $File::Find should not
go into any subdirectories of $DIR and list the files and
subdirectories there as well.
So far, I have not had any luck with the option no_chdir =>0.
find ( {
no_chdir => 0,
wanted => sub {
print "$File::Find::name\n" ;
}
},
$DIR
);
It sounds like you don't need to use File::Find at all:
opendir DH, $DIR or die "Cannot open '$DIR' $!";
print map "$DIR/$_\n", readdir DH;
closedir DH;
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
.
- References:
- $File::Find and no_chdir
- From: Schms
- $File::Find and no_chdir
- Prev by Date: encoding problem?
- Next by Date: Re: Invalid top directory at d:\perl\lib\file\find.pm line 562
- Previous by thread: $File::Find and no_chdir
- Next by thread: Re: $File::Find and no_chdir
- Index(es):