Re: Unlink file older then 7 days

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

 



http://us.php.net/manual/en/function.fileatime.php

$filename = 'somefile.txt';
if (file_exists($filename) && fileatime($filename) < (time()-(7*24*60*60)) )
{
   unlink($filename);
}

Read docs!

Suhas


On 7/16/07, chris@xxxxxxxxxxxx <chris@xxxxxxxxxxxx> wrote:

How would I use fileatime to check if the file is older then 7 days?





>> I have a directory with .txt and .txt.asc files.
>>
>> What I want to do is..
>>
>> Check the age of all files ending in .txt.asc
>>
>> and if the file *.txt.asc is older then 7 days
>>
>> delete thatfile.txt.asc and also thatfile.txt
>>

--
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