Re: $File::Find and no_chdir
- From: mritty@xxxxxxxxx (Paul Lalli)
- Date: Thu, 27 Sep 2007 06:01:22 -0700
On Sep 27, 6:00 am, sc...@xxxxxx (Schms) wrote:
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.
That's because no_chdir has absolutely nothing to do with this issue.
no_chdir simply means that File::Find doesn't change the current
working directory as it recurses.
You want $File::Find::prune. Set it to 1 in your &wanted function any
time the directory is one you don't want to recurse into. See
File::Find's documentation for more info.
And more importantly, see John's reply - if you don't want to recurse,
you shouldn't be using File::Find to begin with. Just get a directory
listing.
Paul Lalli
.
- Follow-Ups:
- Re: $File::Find and no_chdir
- From: Schms
- Re: $File::Find and no_chdir
- References:
- $File::Find and no_chdir
- From: Schms
- $File::Find and no_chdir
- Prev by Date: Re: Invalid top directory at d:\perl\lib\file\find.pm line 562
- Next by Date: Re: Problem with repeating characters in regex
- Previous by thread: Re: $File::Find and no_chdir
- Next by thread: Re: $File::Find and no_chdir
- Index(es):
Relevant Pages
|
|