Created
July 5, 2012 18:31
-
-
Save firestar/3055546 to your computer and use it in GitHub Desktop.
Lines of code in scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$intoVAT = array("/var/path/to/script"); | |
function read_dir($dir, $array = array()){ | |
$dh = opendir($dir); | |
$files = array(); | |
while (($file = readdir($dh)) !== false) { | |
$flag = false; | |
if($file !== '.' && $file !== '..' && is_dir($dir."/".$file)) { | |
$files[] = $dir."/".$file; | |
$files = array_merge(read_dir($dir."/".$file),$files); | |
echo $dir."/".$file."\n"; | |
} | |
} | |
return $files; | |
} | |
$gt = 0; | |
$final = array(); | |
foreach($intoVAT as $into){ | |
if(is_dir($into)){ | |
$final[] = $into; | |
$final = array_merge($final,read_dir($into)); | |
} | |
} | |
$fr = array_unique($final); | |
foreach($fr as $f){ | |
exec("cd ".$f.";wc -l ./*.php",$meow); | |
if (preg_match('/([0-9]+) total/s', $meow[(count($meow)-1)], $out)) { | |
echo $out[1].$f."\n"; | |
$gt += $out[1]; | |
} | |
} | |
echo "TOTAL: $gt"; |
envygeeks
commented
Jul 5, 2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment