Voting

: one plus seven?
(Example: nine)

The Note You're Voting On

yasirlayth at live dot com
15 years ago
this simple function will index the directories and sub-directories of a given dir

<?php
function get_dirs($dir){
global
$dirs;
if (!isset(
$dirs)){$dirs = '';}
if(
substr($dir,-1) !== '\\'){$dir .= '\\';}
if (
$handle = opendir($dir)){
while (
false !== ($file = readdir($handle))){
if (
filetype($dir.$file) === 'dir' && $file != "." && $file != ".."){
clearstatcache();
$dirs .= $file . "\n";
get_dirs($dir . $file);
}
}
closedir($handle);
}
return
$dirs;
}
?>

<< Back to user notes page

To Top