I need to list all the files in a folder including its sub directories.
I have the following code from skiflyer in thread434-682722 which I believe should work.
Say for example I had a folder called c:/test.
I can't figure out the variable to output onto a page.
I have the following code from skiflyer in thread434-682722 which I believe should work.
Code:
function getAllFiles($path, &$files, $recursive=true) {
echo "New directory starting: ".$path."\n";
$dir_handle=opendir($path);
while ($entry = readdir($dir_handle)) {
if (is_file($path."/".$entry)) {
$files[]=$path."/".$entry;
} else {
if ($entry != "." && $entry != ".." && $recursive) getAllFiles($path."/".$entry, $files);
}
}
}
Say for example I had a folder called c:/test.
I can't figure out the variable to output onto a page.