$path) { //Create directory if exists //$directory = explode("\\", $path); $directory = explode("\\", $path); unset($directory[count($directory) - 1]); $directories[end($directory)] = getFolderTree($path); //Verify if exists files foreach ($files as $file) { if (strpos(substr($file, 2), ".") !== false) $directories[] = substr($file, (strrpos($file, "\\") + 1)); } } //Return the directories if (isset($directories)) { return $directories; } //Returns the last level of folder else { $files2return = Array(); foreach ($files as $key => $file) $files2return[] = substr($file, (strrpos($file, "\\") + 1)); return $files2return; } } /** * Creates the HTML for the tree * * @param array $directory Array containing the folder structure * @return string HTML */ function createTree($directory) { $html = ""; return $html; } //Create output //$directory = getFolderTree('..\temp'); //$htmlTree = createTree($directory["temp"]); $directory = getFolderTree('Utilisateurs'); $htmlTree = createTree($directory["Utilisateurs"]); ?> PHP Directories