hallo eike,
hab ziemlich genau das gleiche gebaut, deswegen sende ich fdir einbfach meine klasse.
viele grüsse,
andi
class FileFinder
{
var $returnArray;
function FileFinder()
{
$this->returnArray = array();
}
function getFiles($dir)
{
global $silent;
global $recursive;
global $directoryDelimiter;
global $ignoreEmptyDirs;
$returnArray = array();
if(!$handle=opendir($dir))
{
die();
}
while (false !== ($file = readdir($handle))) {
$actualFullFile = $dir.$directoryDelimiter.$file;
if(is_file($actualFullFile)) //((trim($file) != ".") && (trim($file) != ".."))
{
$returnArray[] = $actualFullFile;
}
elseif ($recursive === true && is_dir($actualFullFile) && (trim($file) != "." && trim($file) != ".."))
{
$tmpArray = $this->getFiles($actualFullFile);
if(is_array($tmpArray))
{
if($ignoreEmptyDirs === true)
{
if(count($tmpArray) > 0)
{
$returnArray[] = $tmpArray;
}
}
else
{
$returnArray[] = $tmpArray;
}
}
}
}
closedir($handle);
if(count($returnArray > 0))
{
return $returnArray;
}
else {
return null;
}
}
}