RecursiveDirectoryIterator

The RecursiveDirectoryIterator provides an interface for iterating recursively over filesystem directories.

<?php
 $path = realpath('E:\xampp\htdocs\test');
 $objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST);
 foreach($objects as $name => $object){
 echo "$name\n".PHP_EOL;
 }
?>
Share

Leave a Reply

Your email address will not be published. Required fields are marked *