Code: Select all
$path = "/public_html/";
$dh = opendir($path);
$i=1;
while (($file = readdir($dh)) !== false)
{
if($file != "." && $file != "..")
{
echo "<a href='/$file'>$file</a>";
if(!is_dir($file))
{
echo " -File";
} else {
echo " -Dir";
}
echo "<br>";
$i++;
}
}
closedir($dh);