note 77049 added to function.DirectoryIterator-construct
| From: | pcdinh at phpvietnam dot net | Date: | Mon, 13 Aug 2007 02:55:42 +0000 |
| Subject: | note 77049 added to function.DirectoryIterator-construct | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-129432@lists.php.net to get a copy of this message | ||
I need to traverse recursively through a directory tree and get all sub-directory paths and has
written a snippet to do that.
<?php
$path = "D:\webroot\phpvietnamcms";
foreach (new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_PATHNAME),
RecursiveIteratorIterator::CHILD_FIRST) as $file => $info) {
if ($info->isDir())
{
echo $file."<br />";
}
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 210.245.51.187
----
Manual Page -- http://www.php.net/manual/en/function.DirectoryIterator-construct.php
Edit -- https://master.php.net/note/edit/77049
Del: integrated -- https://master.php.net/note/delete/77049/integrated
Del: useless -- https://master.php.net/note/delete/77049/useless
Del: bad code -- https://master.php.net/note/delete/77049/bad+code
Del: spam -- https://master.php.net/note/delete/77049/spam
Del: non-english -- https://master.php.net/note/delete/77049/non-english
Del: in docs -- https://master.php.net/note/delete/77049/in+docs
Del: other reasons-- https://master.php.net/note/delete/77049
Reject -- https://master.php.net/note/reject/77049
Search -- https://master.php.net/manage/user-notes.php