Have an account? Sign in
Login  Register  Facebook
This Page is Under Construction! - If You Want To Help Please Send your CV - Advanced Web Core (BETA)
[Edit] Get all contents of directory and all sub-directory

traverse recursively through a directory tree and get all sub-directory paths

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