note 64059 added to function.scandir
| From: | php dot net at simonrycroft dot com | Date: | Thu, 06 Apr 2006 15:36:51 +0000 |
| Subject: | note 64059 added to function.scandir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-107445@lists.php.net to get a copy of this message | ||
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;
}
----
Server IP: 85.116.0.130
Probable Submitter: 130.209.6.41 (proxied: 130.209.46.229)
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.scandir.php
Edit -- http://master.php.net/note/edit/64059
Del: integrated -- http://master.php.net/note/delete/64059/integrated
Del: useless -- http://master.php.net/note/delete/64059/useless
Del: bad code -- http://master.php.net/note/delete/64059/bad+code
Del: spam -- http://master.php.net/note/delete/64059/spam
Del: non-english -- http://master.php.net/note/delete/64059/non-english
Del: in docs -- http://master.php.net/note/delete/64059/in+docs
Del: other reasons-- http://master.php.net/note/delete/64059
Reject -- http://master.php.net/note/reject/64059
Search -- http://master.php.net/manage/user-notes.php