View Single Post
  #4 (permalink)  
Old 07-25-2008, 11:11 AM
punkrazio punkrazio is offline
WebProWorld New Member
 
Join Date: May 2008
Posts: 11
punkrazio RepRank 0
Default 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();
Reply With Quote