Posted by Greg Donald on 10/05/84 11:08
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/
Navigation:
[Reply to this message]
|