Re: Unlink file older then 7 days

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

 



chris@xxxxxxxxxxxx wrote:
> How would I use fileatime to check if the file is older then 7 days?

Erm, If the fileatime is > 7 days???

OK, not quite. This checks the file ACCESS time. This means the last
time the file was read etc.

Now bear in mind that access times for files is generally a very useless
statistic that is very rarely used and to squeeze power out of resources
most web server admins would mount their partitions with noatime option
which would disable this statistic!!

http://ca3.php.net/manual/en/function.filemtime.php
is probably a more appropriate check - based on when the file was last
modified.

Col

PS just in case you were literally asking how, the int that is returned
from these functions are just seconds since epoch, so compare to time()
and if the difference is > (7 * 24 * 60 * 60), it's older than 7 days!

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