>>>>> "Jason" == Jason Wozniak <[EMAIL PROTECTED]> writes:
Jason> I can't seem to limit the search to a specified directory or
Jason> directories with the maxdepth parameter. Assuming it has that
Jason> parameter, as I don't see it in the documentation.
Oddly enough, I had to look, and no, there is no maxdepth method!
Jason> I've tried
Jason> My @file_list =
Jason> File::Finder->type('f')->in('$search_dir')->maxdepth('0');
"->in" is always the last step, returning the results, not another
"File::Finder" object. I suppose I should make that clearer, but
it's listed as a File::Finder method, not a steps method.
The traditional way in find(1) to limit depth is to call "-prune"
when you know you don't want to descend below the current directory.
Since you don't want to descend below any directories, use:
my @list = File::Finder->prune->type('f')->in($search_dir);
which is like
find $search_dir -prune -type f -print_into_the_variable
Oh, yeah, noticed you had single quotes on your var too. Bad. :)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>