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;
 }
?>

Leave a Reply

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