note 64059 deleted from function.scandir by bjori
| From: | bjori@php.net | Date: | Thu, 06 Apr 2006 16:42:44 +0000 |
| Subject: | note 64059 deleted from function.scandir by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-107460@lists.php.net to get a copy of this message | ||
Note Submitter: php dot net at simonrycroft dot com
Reason: in docs
----
Following function scans a directory recursively, adding each file and directory to an array, with
their absolute paths.
function recursiveScandir($dir){
$return_array = array();
$files = scandir($dir);
$num_files = count($files);
for ($i=2; $i<$num_files; $i++){// Ignore . and ..
array_push($return_array,$dir."/".$files[$i]);
if(is_dir($dir."/".$files[$i])){
$return_array = array_merge($return_array,recursiveScandir($dir."/".$files[$i]));
}
}
return $return_array;
}