I have a script that reads all directory names within a specific
location (only containing folders), then lists all jpeg files in those
directories. Here is my script:
function getDir($dir,$foldername){
$d2 = opendir($dir);
while (false !== ($file = readdir($d2))) {
$ext=substr($file,(strlen($file)-3),strlen($file));
if($ext=="jpg" || $ext=="JPG"){
// list $file under heading $foldername
}
}
}
$d1 = opendir('ONLINE/');
while (false !== ($folder= readdir($d1))) {
if($folder!="" && $folder!="." && $folder!=".."){
getDir('ONLINE/'.$folder."/",$folder);
}
}
At the moment, the dirs are read alphabetically, but I would like to
list them by order of date modified.
Can PHP retrieve date information from dirs? If so, how does one do
it?
Cheers,
Eclectic.