note 51221 deleted from ref.dir by sniper
| From: | sniper@php.net | Date: | Fri, 16 Dec 2005 00:01:24 +0000 |
| Subject: | note 51221 deleted from ref.dir by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-100269@lists.php.net to get a copy of this message | ||
Note Submitter: andy.at.azengel.dot.com
----
Here is a very short function to return all files inside a dir with full pathname
<?php //call the function
$myfiles=GetDirContents(dirname($_SERVER['DOCUMENT_ROOT']));
?>
<?php // the function itself
function GetDirContents($dir){
ini_set("max_execution_time",10);
if (!is_dir($dir)){die ("Fehler in Funktion GetDirContents: kein gültiges Verzeichnis:
$dir!");}
if ($root=@opendir($dir)){
while ($file=readdir($root)){
if($file=="." || $file==".."){continue;}
if(is_dir($dir."/".$file)){
$files=array_merge($files,GetDirContents($dir."/".$file));
}else{
$files[]=$dir."/".$file;
}
}
}
return $files;
}
?>