Jump to content
GIGN Forum

Recommended Posts

Šitie joki vnk spārda :superlol:

BriGe Tas tev

<?php
// Noraadi mapi
$dir = "E:/www/htdocs/x/";

//Funkcija kas izmetis vecako failu no mapes
function get_oldest_file($directory) {
    if ($handle = opendir($directory)) {
        while (false !== ($file = readdir($handle))) {
            if (is_file($directory.$file)) {
                $files[] = $file;
            }
        }
      
            foreach ($files as $val) {
                if (is_file($directory.$val)) {
                    $file_date[$val] = filemtime($directory.$val);
                }
            }
    
    }
    closedir($handle);
    asort($file_date, SORT_NUMERIC);
    reset($file_date);
    $oldest = key($file_date);
    return $oldest;
}

// Izmetam vecako failu
$fails = get_oldest_file("$dir");
unlink("$dir/$fails");
?>

Edited by 10BaseT
Link to comment
Share on other sites

if ($handle = opendir('../../../../../AppServ/www/demo/')) {

while (false !== ($file = readdir($handle))) {

if (strlen($file) > 4)

{

$gabali = explode("-", $file);

$date = $gabali[1];

$mape = $gabali[2];

$mapesgabali = explode(".", $mape);

$name = $mapesgabali[0];

$year = substr($date,0,2);

$month = substr($date,2,2);

$day = substr($date,4,2);

$hour = substr($date,6,2);

$minute = substr($date,8,2);

echo "<center>$day.$month.$year             $hour:$minute             $name             <a href=\"http://demons.oo.lv/demo/$file\">Download</a></br></center>";

}

}

closedir($handle);

}

?>

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...