Re: Delete all files in DIR every 20 days

From: Date: Mon, 14 Feb 2005 16:51:24 +0000
Subject: Re: Delete all files in DIR every 20 days
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-208649@lists.php.net to get a copy of this message
On Tue, 15 Feb 2005 01:22:42 +1030, Tim Burgan <email@timburgan.com> wrote: > How can I delete ALL files within a specified directory every 20 days? > Does anyone know of any code-snippets that are around at the moment that > are able to do this? (And where I can find them?) You can put a tmp file in there and use filemtime() to check how old it is. When it's 20 days old, do your deletes. You can setup the check on the filemtime() with cron or whatever scheduling tools you use. if( ( @filemtime( 'tmp_file' ) + 20 * 24 * 60 * 60 ) > time() ) { // do deletes // make new tmp_file } -- Greg Donald Zend Certified Engineer http://destiney.com/

« previous php.general (#208649) next »