hello.
i found this great code snippet on [url]www.php.net:[/url]
$DirectoriesToScan = array(realpath("_temp_files/zip_upload"));
$DirectoriesScanned = array();
while (count($DirectoriesToScan) > 0) //<
{
foreach ($DirectoriesToScan as $DirectoryKey => $startingdir) //<
{
if ($dir = @opendir($startingdir))
{
while (($file = readdir($dir)) !== false)
{
if (($file != '.') && ($file != '..'))
{
$RealPathName = realpath($startingdir.'/'.$file);
if (is_dir($RealPathName))
{
if (!in_array($RealPathName, $DirectoriesScanned) && !in_array($RealPathName, $DirectoriesToScan))
{
$DirectoriesToScan[] = $RealPathName;
}
}
elseif (is_file($RealPathName))
{
$FilesInDir[] = $RealPathName;
}
}
}
closedir($dir);
}
$DirectoriesScanned[] = $startingdir;
unset($DirectoriesToScan[$DirectoryKey]);
}
}
$FilesInDir = array_unique($FilesInDir);
it saves all files (even in subdirs) from (DirectoriesToScan) into an array (FilesInDir). But now I've got a problem: there are only the files listed, but not the directories!
i know, i could just easily get the dirs, because they are listed in the files-paths, but what if there's NO file in a dir? then it won't be listed in the array!
now, can anybody modify this code, so there are also the dirs and subdirs listed in the array?? it's just too hard for me, i don't get it. 🙁
thx very much for help!!! 🙂
gr33tz j0sh