note 51220 deleted from ref.dir by betz
| From: | betz@php.net | Date: | Fri, 25 Mar 2005 11:55:03 +0000 |
| Subject: | note 51220 deleted from ref.dir by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-86954@lists.php.net to get a copy of this message | ||
Note Submitter: andy at azengel dot com
Reason: useless
----
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;
}
?>