#34615 [Opn->Bgs]: RecursiveDirectoryIterator is not recursive
| From: | johannes@php.net | Date: | Fri, 23 Sep 2005 13:33:53 +0000 |
| Subject: | #34615 [Opn->Bgs]: RecursiveDirectoryIterator is not recursive | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-85500@lists.php.net to get a copy of this message | ||
ID: 34615
Updated by: johannes@php.net
Reported By: richard dot quadling at bandvulc dot co dot uk
-Status: Open
+Status: Bogus
Bug Type: SPL related
Operating System: Windows
PHP Version: 5.0.5
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
You need a RevursiveIteratorIterator. Have a look at
http://cvs.php.net/php-src/ext/spl/examples/
or Marcus'
slides at http://talks.somabo.de
Previous Comments:
------------------------------------------------------------------------
[2005-09-23 15:30:03] richard dot quadling at bandvulc dot co dot uk
Description:
------------
Hopefully, my simple brain can explain this properly.
I want to use the RecursiveDirectoryIterator class.
Iterator = get "elements" from a "list", one at a time.
Directory = a "list" of files and directories (and links for those *ix
bods).
Recursion = Repeat until complete on any "element" which contains a
"list".
So, DirectoryIterator should return a list of files/directories for a
single directory.
Which it does.
<?php
$objDI = new DirectoryIterator("C:/");
foreach($objDI as $key => $value)
{
echo "$key $value\n";
}
?>
produces a list of all the files and directories in the root of my C:.
Just like I would expect.
A RecursiveDirectoryIterator
So, in my limited understanding (OK, I'm being facetous - I've been
fighting Crystal Reports all day, so please give me a break), by using
the RecursiveDirectoryIterator, I would expect to get a list of all the
files and directories and sub-directories from C:\ onwards, a complete
treewalk.
<?php
$objRDI = new RecursiveDirectoryIterator("C:/");
foreach($objRDI as $key => $value)
{
echo "$key\n";
}
?>
But no.
All this does is print the same list as DirectoryIterator. Admittedly,
the name is now a key and the value is an object, but how is this
recursive?
Either proper documentation for RecursiveDirectoryIterator (what is it
recursing?) or a change to the name as it is NOT recursing is
appropriate.
I've read the documentation at Helly, but it makes no sense as there no
examples. It looks like I have to implement the recursion myself, so
what does the class recurse?
Hopefully you can see my problem.
Richard Quadling.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34615&edit=1