note 30304 added to ref.filesystem
| From: | Alex at rack1 dot php dot net | Date: | Thu, 13 Mar 2003 14:03:00 +0000 |
| Subject: | note 30304 added to ref.filesystem | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-45218@lists.php.net to get a copy of this message | ||
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;
}
--
http://www.php.net/manual/en/ref.filesystem.php
http://master.php.net/manage/user-notes.php?action=edit+30304
http://master.php.net/manage/user-notes.php?action=delete+30304
http://master.php.net/manage/user-notes.php?action=reject+30304