I just made a very crappppy script, it works but it's not pretty. I pieced it together from php.net by reading up on some things and using code people have posted in comments. I take no credit, but I read so many different comments I don't know who's code I used.
CODE
<?php
function scanDirectories($rootDir, $allData=array()) {
// set filenames invisible if you want
$invisibleFileNames = array(".", "..", ".htaccess", ".htpasswd");
// run through content of root directory
$dirContent = scandir($rootDir);
foreach($dirContent as $key => $content) {
// filter all files not accessible
$path = $rootDir.'/'.$content;
if(!in_array($content, $invisibleFileNames)) {
// if content is file & readable, add to array
if(is_file($path) && is_readable($path)) {
// save file name with path
$allData[] = $path;
// if content is a directory and readable, add path and name
}elseif(is_dir($path) && is_readable($path)) {
// recursive callback to open new directory
$allData = scanDirectories($path, $allData);
}
}
}
return $allData;
}
function print_ar($array, $count=0) {
foreach($array as $key=>$value){
if(is_array($value)){
echo "[<strong><u>$key</u></strong>]<br />";
$count++;
print_ar($value, $count);
$count--;
}
else{
$tab2 = substr($tab, 0, -12);
echo "$tab2 <a href='/$value'>$value</a><br />";
}
$k++;
}
$count--;
}
print_ar(scanDirectories("test"));
?>
Change the last line from test to whatever directory your files are in