The following code lists a directory structure, and the files within ieach directory. The directories are meeting dates (01-05-2004, 02-05-2004) It lists them starting with the lowest number (01-05-2004). I am trying to reverse the order, so that newest meetings are listed first. (07-05-2004, 06-05-2004) Is this possible to do using a script that reads directory structure? Any help is greatly appreciated!
Here is the code:
<?php
create_tree(".");
function create_tree($file_dir)
{
if ($handle = @opendir($file_dir))
{
$i=0;
while (false !== ($file = @readdir($handle)))
{
if ($file != "." && $file != ".." && $file != "list.php" && $file != "Judy Prep" && $file != "list.asp")
{
$list[$i]=$file;
$i++;
}
}
$dir_length = count($list);
for($i=0;$i<$dir_length;$i++)
{
if(strrpos($list[$i], ".") == FALSE)
{
echo "<br><b>".$list[$i]."</b>\n";
create_tree($file_dir."/".$list[$i]);
}
else
{
echo "<br> <a href=\"".MeetingInformation."/".$file_dir."/".$list[$i]." \" target=\"_blank\">".substr($list[$i],0,-4). "</a></b>\n";
}
}
echo "<br>";
closedir($handle);
}
}
?>