Re: php cron to check and remove files

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

 



I handle your object a different and, I believe, a simpler way.

Instead of a cronjob, I call a cleanup function whenever a page is opened.

Obviously, this approach requires a time overhead and thus is not good for very high volume sites. You can mitigate this drawback by maintaining a simple touch() file that keeps track of the time when your cleanup function is run and insure it only runs once a day, or whatever frequency you need. You can even make the file sticky so it stays in memory to further reduce the overhead.



Steven Macintyre wrote:
 Hi,

I need to be able to do the following procedure;

retrieve all items from a mysql db table, then check to see if the files from that table exist on the server (images), if not, to "clean up" and remove the physical file - so that only the files from the db exist.

This will run via cron

Has anyone done something similar before, willing to assist me with a basic scope of actions to work on?

Thanks in advance

Steven


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