Well, I finally figured out a way to take care of my file recursion problem with File::Find...however...

When I run the code, it goes into every directory *BUT* the one I want it to. I'm sure the solution is going to make me feel dense...but here's the code:

#### rerurseDir
# Description:
#       This implements the logical recursion that we use to
#       cheat the order find() imposes;
# Params: 
#       $initPath -> The path to start in.
####
sub recurseDir
{
  my $initPath = shift;
  my @symlinks;  
  my @dirs  =  File::PathConvert::rel2abs($initPath);
  my @tempLink; 
  my @tempDir;
  
  while ( @symlinks or @dirs )
  {
    if(@symlinks)
    {
      my ($L, $D) = callFind(@symlinks);
      @tempLink = (@tempLink, @{$L});
      @tempDir = (@tempDir, @{$D});
    }  
    if(@dirs)
    {
      my ($L, $D) = callFind(@dirs);
      @tempLink = (@tempLink, @{$L});
      @tempDir = (@tempDir, @{$D});
    }
          
    @symlinks = @tempLink;
    @dirs = @tempDir;
        
    @tempLink = @tempDir = ();
  }
}  

#### callFind  
# Description:
#       A wrapper for find();
# Params:
#       @work -> The array of directories to call find on.
# Returns:
#       \@returnLink -> A reference to an array with paths to links in it
#       \@returnDir  -> The same but with normal dirs instead of links
####
sub callFind()
{
  my @work = @_;
  my @returnLink;
  my @returnDir;
  
  foreach my $entry (@work)   
  {
    find( sub
    {
      return if ( $_ eq '.' || $_ eq '..');
      
      #my $path = abs_path($File::Find::dir);
      if( -d $_ && !-l $_ )
      {
        $File::Find::prune = 1;
        push @returnDir, File::PathConvert::rel2abs($_) unless ( $_ eq "www" or $_ eq "perl" or $_ eq "lost+found" );
      }
      elsif( -l $_ && -d $_ && $_ =~ /^bin$/ or /^current$/)
      {
        push @returnLink, File::PathConvert::rel2abs($_)
      }
      else
      { 
        parseFile(File::PathConvert::rel2abs($_)) unless ($_ =~ /bak$/);
      }
    } , $entry );
  }
  return \@returnLink, \@returnDir;
}

Well, that's the portion that is relevant.  parseFile() is a subroutine that works (it just basic pattern matching).
parseFile also has the check to see if it is a text file before parsing.

Given this directory structure:

myprojectdir
\
 |-> bin -> bin_1.7
 |
 |-> bin_1.1
 |
 |-> bin_1.2
 :
 |-> bin_1.7

The above code evaluates bin_1.1 thru bin_1.6 (hidden by the ..) but IGNORES bin_1.7.

The desired outcome is exactly the opposite: evaluate bin_1.7, but ignore the rest.

Help?

Thanks,
Sam


In reply to It does exactly the opposite of what I want it to! by SamQi

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.