Ok. The problem you had with File::Find (which I personally would feel more comfortable with, ive never even heard of File::Recurse) is that you didnt use the option no_chdir and/or you didn't use $File::Find::name. (Actually I have serious reservations about using a module that isnt in the standard distro when there is one in the standard distro that does the same thing. Theres good reason why it got into the standard distro in the first place.)
use strict; use warnings; use File::Find; # Extensions to match my @exts=qw(.nsf .exe); my $search_root='D:\\Bin\\'; # where to start the search # Build a regex my $rexstr=join'|',map {quotemeta $_} @exts; my $rex=qr/(?:$rexstr)$/i; # list of filespecs my @list; # Find em thanks find({ wanted =>sub{push @list,$_ if (/$rex/ && -f)} , no_chdir => 1 } +, $search_root); # And print em out print join "\n",@list;
Adding the email code and etc is left as an exercise for the read... ;-)

BTW: Ive found there is a cute little trick with File::Find under windows. If you use MS style paths (ie backslashes) and dont take advantage of perls ability to handle either then File find will return paths like

D:\Bin\/autoruns.exe
Which means that you can easily tell where the childrens path starts by looking for slashes and not backslashes. (Dont worry about \/ Perl handles it transparently.) But be aware that using the trick makes your code completely unportable.

HTH

Yves / DeMerphq
--
When to use Prototypes?
Advanced Sorting - GRT - Guttman Rosler Transform


In reply to Re: Best Way to Search and Delete files on a large Windows Filesystem by demerphq
in thread Best Way to Search and Delete files on a large Windows Filesystem 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.