$forbiddenDirs = array("Privat", "Source", "cgi-bin", "data", "luckie-online");
function ScanDirectories($dir, array $forbiddenDirs=array(), array $allData=array())
{
if ($
handle = opendir($dir)) {
while (false !== ($file = readdir($
handle))) {
if ($file == "." || $file == ".." || in_array($file, $forbiddenDirs)) {
continue;
}
if (is_dir($dir . DIRECTORY_SEPARATOR . $file)) {
$allData[] = $dir . DIRECTORY_SEPARATOR . $file;
$allData = ScanDirectories(
$dir . DIRECTORY_SEPARATOR . $file,
$forbiddenDirs,
$allData
);
}
}
return $allData;
} else {
throw new
Exception('Failed to open directory: ' . $dir);
}
}