note 34321 added to function.is-dir
| From: | ltena at gmx dot net | Date: | Wed, 23 Jul 2003 21:35:32 +0000 |
| Subject: | note 34321 added to function.is-dir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-52522@lists.php.net to get a copy of this message | ||
Recursive function to browse folders (Unix)
$base = '/home/';
function getDirList($base)
{
if(is_dir($base)){
$dh = opendir($base);
while (false !== ($dir = readdir($dh))) {
if (is_dir($base . $dir) && $dir !== '.' && $dir !==
'..') {
$subs = $dir ;
$subbase = $base . $dir . '/';
print $subbase . "<br>";
getDirList($subbase);
} else {
next;
}
}
closedir($dh);
} else {
print "no es dir";
}
}
getDirList($base);
Regards
Luis Tena O.
Mexico City
----
Manual Page -- http://www.php.net/manual/en/function.is-dir.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34321
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34321&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34321&report=yes