TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Advanced PHP Programming (http://www.talkphp.com/advanced-php-programming/)
-   -   Count file in dir with matching $string at a line $var... (http://www.talkphp.com/advanced-php-programming/3748-count-file-dir-matching-string-line-var.html)

Peuplarchie 12-10-2008 05:20 AM

Count file in dir with matching $string at a line $var...
 
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 :
PHP Code:

 // 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 !

Wildhoney 12-11-2008 03:09 AM

Is it something like this you're after?
  • Search specified directory;
  • Open each file and navigate to the specified line number;
  • If you find the line, increment one and continue;


All times are GMT. The time now is 08:25 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0