Here is a function I use in some of my apps you can list files in just one folder or recursively to look through all your folders...
Your must set the $directory = '/path/to/public_html/'; to your root path.
<?php
function app_load_files($directory='',$recursive='0')
{
if($directory == '')
{
// Find right directory
$directory = '/path/to/public_html/';
}
// create a handler for the directory
$handler = opendir($directory);
// keep going until all files in directory have been read
while ($file = readdir($handler))
{
// if $file isn't this directory or its parent,
if ($file != '.' && $file != '..')
{
if(is_file($directory . $file))
{
// Here we include each file in the library so that the
// functions in each file are available for use
echo $directory . $file . '<br />';
}
elseif(is_dir($directory . $file) && $recursive == '1')
{
echo '<hr />';
app_load_files($directory . $file . '/');
}
}
}
// tidy up: close the handler
closedir($handler);
}
app_load_files();
?>
Sample usage(s):
To show all the files only in your home directory
app_load_files();
To show all the files your home directory and continue through any sub-folders
app_load_files('','1');
To show all the files only in the directory of your choice
app_load_files('images');
To show all the files the directory of your choice and continue through any sub-folders
app_load_files('images','1');