Hi There., I have a script that lists directorys then how many files are in each.
although it won't list in an A-Z format, would anyone know how i would do this?
Any help would be greatly appreciated and all required code is included below
TIA
Andy
<?
function romcount($system, $counter) {
if ($handle = opendir("roms/$system")) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$counter++;
}
}
closedir($handle);
}
} // end function romcount
function listsystems() {
if ($handle = opendir('roms')) {
while (false !== ($system = readdir($handle))) {
if ($system != "." && $system != "..") {
// count roms
$counter = 0;
if ($handle2 = opendir("roms/$system")) {
while (false !== ($file = readdir($handle2))) {
if ($file != "." && $file != "..") {
$counter++;
}
}
closedir($handle2);
}
$totalroms = $totalroms + $counter;
// end count roms
echo "<div align=\"center\"><center><table border=\"0\"
cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse\"
bordercolor=\"#111111\" width=\"80%\" id=\"AutoNumber1\"><tr><td width=\"91%\"><a
href=\"index.php?page=download2&system=$system\">$system</a></td><td
width=\"20%\"><center>($counter)</center></td></tr></table></center></div></center>";
}
}
closedir($handle);
echo "<center><Br><b>We Currently Have $totalroms ROMs!</b></center><BR>";
}
} // end function listsystems
?>
<?
listsystems();
?>