On Mon, Mar 1, 2010 at 6:18 PM, Shawn H Corey <shawnhco...@gmail.com> wrote:

> raphael() wrote:
> > Hi,
> >
> > How can I stop File::Find to go below current dir? i.e. no recursion.
> >
> > Although I can use glob or <*> to get file names in current dir.
> > But I wanted to know if File::Find has a maxdepth limit like linux
> "find".
> >
> > The script I created uses a switch which decides if recursion is allowed
> or
> > not.
> > It uses the system find like this..
> >
> > open(FIND, "find -maxdepth $recursive |" );
> >
> > I wanted to remove this dependency on system find. Is it possible with
> > File::Find?
> >
> > I tried this after googling
> >
> > http://www.perlmonks.org/?node_id=676958
> >
> > sub wanted
> > {
> >     if ( -d ) { # should I write this as -d $File::Find::name
>
> # No, this is shorthand for:
>    if( -d $_ ){
>
> >           $File::Find::prune = 1;
> >           return;
> >     }
> >     print $File::Find::name . "\n";
> > }
> >
>
> And didn't it work?  The if statement works on all directories.  This
> means that all directories except the top-level one will not be searched.
>
>
> --
> Just my 0.00000002 million dollars worth,
>  Shawn
>
> Programming is as much about organization and communication
> as it is about coding.
>
> I like Perl; it's the only language where you can bless your
> thingy.
>
> Eliminate software piracy:  use only FLOSS.
>

Nope. It ddn't work. Any ideas?
I am thinking to use File::Find::Rule. But I didn't want any module
dependency for this script.

And Shlomi your message came in while I was typing this. Going to check the
modules you mentioned.
But it would have been great if I didn't has to use a module :( The people
around me no sh*t about installing perl
modules from CPAN.

Thanks all.

PS - Shlomi, your website is GOOD!

Reply via email to