note 30304 deleted from ref.filesystem by nlopess
| From: | nlopess@php.net | Date: | Sun, 03 Jul 2005 21:24:43 +0000 |
| Subject: | note 30304 deleted from ref.filesystem by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-91377@lists.php.net to get a copy of this message | ||
Note Submitter: Alex Chacón
----
alex.chacon@terra.com
Hi
Here there is a function that recursively print all the directories in a Unix system from initial
path in pre-order.
$pathInicial = "/home1/desarrollo/";
recorrerDirectorioTree ($pathInicial);
function recorrer DirectorioTree($pathGeneral)
{
echo $pathGeneral . "\n\n";
chdir($pathGeneral);
$dir = dir(".");
$dir-> rewind();
while ($fileName = $dir->read())
{
if ($fileName != "." && $fileName != "..")
{
if (is_dir($fileName) && !is_link($fileName))
{
echo "$fileName \n";
clearstatcache();
recorrerDirectorioTree($pathGeneral.$fileName. "/");
chdir($pathGeneral);
}
}
}
$dir->close();
return;
}