Re: [PHP] RE: Check to remove file that are older than 1 week

2004-02-17 Thread Ian Firla

On Fri, 2004-02-20 at 17:35, YC Nyon wrote:
 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

I have a bash script that I use:

#! /bin/bash
# call as: ./delete_old.sh directory days
# days is the age limit for files you want to keep (ie. 3, 5, 7, etc)

find $2 -type f -mtime +$1 | xargs rm

Ian

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



[PHP] RE: Check to remove file that are older than 1 week

2004-02-05 Thread YC Nyon
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



Re: [PHP] RE: Check to remove file that are older than 1 week

2004-02-05 Thread Michal Migurski
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.

If you're running PHP under unix:
http://marc.theaimsgroup.com/?l=php-generalm=106002263306528w=2

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

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



[PHP] Re: Check to remove file that are older than 1 week

2004-02-05 Thread Eric Bolikowski
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