read(); $directory->read(); while (false !== ($entry = $directory->read())) { $currentPath = $path; if (is_dir($path . DIRECTORY_SEPARATOR . $entry)) { $currentPath = $path . DIRECTORY_SEPARATOR . $entry; $content = getAllFiles($currentPath); } else { $content = $entry; } $result[realpath($currentPath)][] = $content; } } return $result; } $files = []; foreach ($GLOBALS['paths'] as $path) { if (is_dir($path)) { $files[$path][] = getAllFiles($path); } } function printFiles($files) { echo ''; } if (!isset($_GET['f'])): ?>