Re: Delete all files in DIR every 20 days

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 15 Feb 2005 01:22:42 +1030, Tim Burgan <email@xxxxxxxxxxxxx> 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/

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux