Darrell Snedecor wrote:

> How can I keep file::find from descending into subfolders of
> $DataFolders_Location?  I can't get prune to work.
> 
>       sub DelMiscFiles {
>               if(m/
>                        EDWin\d{3}.ver$
>                       |safe.{16,25}$
>                       |.+\.stru$
>                       |ffexport.exe$
>                       |sendcopydata\d{4}\.zip$
>                       |eddata\.zip$
>                       |edwin\.\d$
>                       |u142\..{3}$
>                       |u313\..{3}$
>                       |prev142.txt$
>                       |prev313.txt$
>                       |.*.bak$
>                       |.*.tbk$
>                       |_[A-Za-z1-9]{7}$
>                       |EDWin_Whats_New.exe$
>                       |edwin_2005.chm$
>                       |foxuser\....$
>                       |.+\.prn$
>                       /ix){
>                       unlink $File::Find::name;
>               }
>               #if(-d $File::Find::name){
>               #       $File::Find::prune = 1; # do not descend the
> directory tree
>               #}
>       }
>       find(\&DelMiscFiles, $DataFolders_Location  );

This works for me:

find (\&Wanted, '.');
exit;

sub Wanted {

return if /^\.{1,2}$/;  # skip . and ..

if (-d $File::Find::name) {
        print "Pruning $File::Find::name\n";
        $File::Find::prune = 1; # do not descend the directory tree
        return;
}

# any other code here

}


-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to