Count file in dir with matching $string at a line $var...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Peuplarchie
Forum Contributor
Posts: 148
Joined: Sat Feb 04, 2006 10:49 pm

Count file in dir with matching $string at a line $var...

Post by Peuplarchie »

Good day to you all,
I'm wondering how can I count files in a directory that as a specific word in a specific line number which would be :

Code: Select all

 
// I know how to count folder...
  function CountDir($aDir, $aRecurse)
  {
    $Count = 0;
    $d = dir($aDir);
    while ($Entry = $d->Read())
    {
      if (!(($Entry == "..") || ($Entry == ".")))
      {
        if (Is_Dir($aDir . '/' . $Entry))
        {
          if ($aRecurse)
          {
            $Count += CountDir($aDir . '/' . $Entry, $aRecurse);
          }
        }
        else
        {
          $Count++;
        }
      }
    }
    return $Count;
  }
 
 
// I would need to include something like this iguess..
 
if ($lines[$line13] == "Pending"){
count++
}
 
 
 
 
 


Thanks !
Post Reply