PHP Files sorting by size
Files sorting by size
<?
$path = "test";
$what = "filesize"; //filemtime fileatime
$dh = @opendir($path);
while (false !== ($file=readdir($dh))) {
if (substr($file,0,1)!=".") $files[]=array($what("$path/$file"),$file);
}
closedir($dh);
if ($files) {
rsort($files);
foreach ($files as $file) echo "$file[0] $file[1]<BR>";
}
?>