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
          $File::Find::prune = 1;
          return;
    }
    print $File::Find::name . "\n";
}

Reply via email to