Voting

: max(four, zero)?
(Example: nine)

The Note You're Voting On

pcdinh at phpvietnam dot net
17 years ago
I need to traverse recursively through a directory tree and get all sub-directory paths and has written a snippet to do that.

<?php
$path
= "D:\webroot\phpvietnamcms";
foreach (new
RecursiveIteratorIterator(
new
RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_PATHNAME), RecursiveIteratorIterator::CHILD_FIRST) as $file => $info) {
if (
$info->isDir())
{
echo
$file."<br />";
}
}

?>

<< Back to user notes page

To Top