Hi

Here's a little function I made up for this:

<?php

function delete_old_files($dir, $time_limit = 0){
 if(!$time_limit) $time_limit = 7*24*60*60;
 if ($df = opendir($dir)) {
  while (false !== ($file = readdir($df))) {
   if ($file != "." && $file != "..") {
    $last_modified = filemtime($file);
    if(time()-$last_modified > $time_limit){
     unlink($file);
    }
   }
  }
  closedir($df);
 }
}

delete_old_files('.');

?>

Hope that's what you need.

Eric


"Yc Nyon" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I want to delete files than are older than 1 week from a specific
directory.
> Anyone mind to share their code? Can't anything on phpbuilder on this.
>
> Regards
> Nyon

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to