Index to $mypth5 \n";
$n = 0;
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
// if begins with dot, skip
if (ereg("^\.", $file)) { echo ""; }
else {
$n = $n + 1; // inc. count
if (is_dir($file)) { $array_dir[] = $file; }
else { $array_file[] = $file; }
}
}
closedir($dh);
}
if ($n > 20) { $lf = "
"; } else { $lf = "
"; } $date_format = 'd-M-Y'; //see http://php.net/date sort($array_dir); foreach ($array_dir as $item) { echo "[$item]"; $s = filesize($dir . $item); $unit = "bytes"; if ($s > 1000) { $unit = 'k' . $unit; $s = round($s / 1000); } if ($s > 1000) { $unit = 'Mbytes'; $s = round($s / 1000); } echo " $s $unit. "; $f = filemtime($dir . $item); $f = date($date_format, $f); echo " $f"; echo "$lf\n"; } sort($array_file); foreach ($array_file as $item) { echo "$item"; $s = filesize($dir . $item); $unit = "bytes"; if ($s > 1000) { $unit = 'k' . $unit; $s = round($s / 1000); } if ($s > 1000) { $unit = 'Mbytes'; $s = round($s / 1000); } echo " $s $unit. "; $t = filemtime($dir . $item); $f = date($date_format, $t); echo " $f"; echo "$lf\n"; } ?>