Hi There. I have a bit of code that lists directorys and how many files are in each. But it won't list them in an A-Z Format. would anyone know how to do this?
<?
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();
?>
any help will be appreciated! many thanks!!