Re: order file by last mod
its useless put everything so small in a database
anyway i have found the solution for every one who need it:
$arrayfile = Array();
function ordina($file1,$file2)
{
$tempo1 = filectime($file1);
$tempo2 = filectime($file2);
return ($tempo1 < $tempo2) ? 1 : -1;
}
if ($handle = opendir('/web/htdocs/domain/home/customer/update_stock/'))
{
while (false !== ($file = readdir($handle)))
{
if ($file != "." && $file != "..") {
$arrayfile[]='../customer/update_stock/'.$file;
}
}
closedir($handle);
usort($arrayfile,'ordina');
//print_r($arrayfile);
foreach($arrayfile as $txt)
{
echo "<a href=\"$txt\" target=\"_blank\">".str_replace("../customer/update_stock/","",$txt)."</a><br>\n";
}
}
clearstatcache();
|