in reply to Re: Pruning directory searches with File::Find
in thread Pruning directory searches with File::Find
actually, you should use:
use File::Spec 'catfile'; ## later, in sub wanted... if( -d catfile( $File::Find::dir, $_) && m/\A_/) { $File::Find::prune= 1; return; }
you need to specify the absolute path to the file system object you're accessing. $_ stores the name relative to the current search directory within File::Find. also, File::Spec will give you the platform independence you secretly crave ;P
but, overall, i'd still suggest broquaint's method. File::Find::Rule makes code like this easier to code, understand, and maintain.
~Particle *accelerates*
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re^2: Pruning directory searches with File::Find
by bluto (Curate) on Jul 25, 2003 at 21:03 UTC |