/** * Recursively compress the text files in the given directory and all directories under it * * @param mixed $dir */ function CheckDir($dir, $startWith = '') { global $count; global $pruned; $count++; echo "\r{$count} ({$pruned}): Checking {$dir} "; $started = false; if (!strlen($startWith)) { $started = true; } // see if this is a directory we need to prune if ($started && is_dir("{$dir}/video_2")) { PruneDir($dir); } else { // recurse into any directories $f = scandir($dir); foreach ($f as $file) { if (!$started && $file == $startWith) { $started = true; } if ($started && is_dir("{$dir}/{$file}") && $file != '.' && $file != '..') { CheckDir("{$dir}/{$file}"); } } unset($f); } }
function CheckDir($Create_Structure, $PC_Structure, $sum) { foreach ($Create_Structure as $key => $Level) { if (!is_array($PC_Structure[$key])) { // echo 'I must create key: '.$key.'<br />'; $sum++; $PC_Structure[$key] = array(); } $sum = CheckDir($Create_Structure[$key], $PC_Structure[$key], $sum); } return $sum; }
/** * Recursively compress the text files in the given directory and all directories under it * * @param mixed $dir */ function CheckDir($dir, $startWith = '') { $started = false; if (!strlen($startWith)) { $started = true; } // compress the text data files $f = scandir($dir); foreach ($f as $file) { if (!$started && $file == $startWith) { $started = true; } if ($started) { if (gz_is_file("{$dir}/{$file}/testinfo.json")) { CheckTest("{$dir}/{$file}"); } elseif (is_dir("{$dir}/{$file}") && $file != '.' && $file != '..') { CheckDir("{$dir}/{$file}"); } } } }
function CheckDir($sourceDir) { $counter = 0; $sourceDir = FixDirSlash($sourceDir); // Copy files and directories. $sourceDirHandler = opendir($sourceDir); while ($file = readdir($sourceDirHandler)) { // Skip ".", ".." and hidden fields (Unix). if (substr($file, 0, 1) == '.') { continue; } $sourcefilePath = $sourceDir . $file; if (is_dir($sourcefilePath)) { $counter += CheckDir($sourcefilePath); } if (!is_file($sourcefilePath) || @GetFileExtension($sourcefilePath) != 'php' || !CheckUtf8Bom($sourcefilePath)) { continue; } echo $sourcefilePath, '<br />'; $counter++; } return $counter; }