$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_SEPERATOR . $file)) {
$allData[] = $dir . DIRECTORY_SEPERATOR . $file;
$allData = ScanDirectories(
$dir . DIRECTORY_SEPERATOR . $file,
$forbiddenDirs,
$allData
);
}
}
return $allData;
} else {
throw new
Exception('Failed to open directory: ' . $dir);
}
}
$allDirs = (ScanDirectories("."));
print_r($allDirs);