Hi,
Ok i have my sorted directory listing. It is working well, i just wanted to see if there were a faster method or ways to optimize it.
Also, I want to see how to skip over certain files, like .htm and .php files. So when I read the file into the array, I would just skip over it. Thanks,
Chuck
<?php
$dirpath = 'directory';
$dh = opendir($dirpath);
while (false !== ($file = readdir($dh)))
{ if (!is_dir("$dirpath/$file"))
{ $file_name_array[] = $file;
}
}
sort($file_name_array);
foreach($file_name_array as $filename)
{ echo "<a href=directory/$filename>$filename<br />\n</a>";
}
closedir($dh);
?>