Prev | Current Page 158 | Next

Hasin Hayder

"Object-Oriented Programming with PHP5"


The recursive directory Iterator can be used to great effect with
RecursiveIeratorIterator to implement the recursion. Let's take a look at the
following example, it traverses through all the directories under a directory (no
matter how nested it is):
// Create the new iterator:
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(
'c:/spket' ));
foreach( $it as $key=>$file )
{
echo $key."=>".$file."\n";
}
?>
Standard PHP Library
[ 154 ]
The output is like this one:
c:/spket/epl-v10.html=>epl-v10.html
c:/spket/notice.html=>notice.html
c:/spket/startup.jar=>startup.jar
c:/spket/configuration/config.ini=>config.ini
c:/spket/configuration/org.eclipse.osgi/.manager/
.fileTableLock=>.fileTableLock
c:/spket/configuration/org.eclipse.osgi/.manager/
.fileTable.4=>.fileTable.4
c:/spket/configuration/org.eclipse.osgi/.manager/
.fileTable.5=>.fileTable.5
c:/spket/configuration/org.eclipse.osgi/bundles/4/1/.cp/
swt-win32-3236.dll=>swt-win32-3236.dll
c:/spket/configuration/org.eclipse.osgi/bundles/4/1/.cp/
swt-gdip-win32-3236.dll=>swt-gdip-win32-3236.dll
c:/spket/configuration/org.eclipse.osgi/bundles/48/1/.cp/os/win32/
x86/localfile_1_0_0.


Pages:
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170