$path = '.';
$directory = new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS);
$iterator = new RecursiveIteratorIterator($directory);
$iterator->setMaxDepth(2);
foreach ($iterator as $path => $info) {
echo $path, "\n";
}