You are here: Re: [PHP] Delete all files in DIR every 20 days « PHP « IT news, forums, messages
Re: [PHP] Delete all files in DIR every 20 days

Posted by Greg Donald on 09/29/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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация