fruiture,

Thanks for the reply (as well as everyone else). I tried your code in my script as such:
# Build a Regex my $rexstr=join'|',map {quotemeta $_} @exts; my $rex=qr/(?:$rexstr)$/i; # Directory to Ignore my $dir = qr/pics/i; my @list; # Find the files find({ wanted =>sub{ print "Found a match: $_\n" if /$rex/; push @list,$_ if /$rex/} , no_chdir => 1, preprocess => sub { grep not /$dir/ => @_ }, }, $search_root );
but I'm getting the error:
Not enough arguments for grep at test.pl.txt line 30, near "@_ }" Execution of test.pl.txt aborted due to compilation errors.
I think my syntax is correct. I did end up taking John M. Dlugosz and FamousLongAgo suggestion and use a blank return statement instead and I got it to do what I want. I'm still curious about this preprocess function though. I could not find any mention to it in the File::Find docs. nor in perlsub Where can I read more on this function?

Also, I went back and read my node and in my text, and  next if $string, should have read  next if $dir. Hope that didn't confuse anyone.

Thanks,
Dru
Another satisfied monk.

In reply to Re: Re: Ignoring a Directory with File::Find by dru145
in thread Ignoring a Directory with File::Find by dru145

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.