On 27 Sep., 15:01, [EMAIL PROTECTED] (Paul Lalli) wrote: > On Sep 27, 6:00 am, [EMAIL PROTECTED] (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
Thanks Paul and John. So, I will try with opendir DH, $DIR or die "Cannot open '$DIR' $!"; print map "$DIR/$_\n", readdir DH; closedir DH; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/