<?
###################################
$filelist['dirs'][0] = $Path;
$makePath = $Path . $subPath;
@chdir($makePath);
$here = opendir('.');
###################################
while ($file = readdir($here)) {
if (is_dir($file) && ($file != "." && $file != "..")) {
$filelist['dirs'][count($filelist['dirs'])] = $file;
}
if (is_file($file) && ($file != "." && $file != "..")) {
$filelist['files'][count($filelist['files'])] = $file;
}
} closedir($here);
?>
/////////////////////////////////////////////
Just feed the above script the variables for $Path and $subPath ie:
$Path = '/www/vhosts/www.mysite.com/htdocs';
$subPath = '/files'; //->note subpath is optional
and then test the array $filelist['files']
like so:
<?
if (!is_array($filelist['files'])) {
echo "no files found!";
}
?>