Upload Website

charliecreed

Verified User
Joined
Feb 26, 2006
Messages
56
Hello,

I run http://www.proupload.com - I have directadmin on the server anyway here's the question

Im trying to make a script of some kind which will run on a crond, It will check all files in a certain directory so lets say /uploads/ and it will delete files which are older than 30 days.

However I only want it to delete if it hasnt been visited within those 30 days.

Any ideas how I can do this?

Thanks,
Charlie
 
The easiest way would probably to write a php script to keep track of the dates and downloads in a MySQL database. Then you would simply run your php cleanup script that would go through the database to find files that hadn't been downloaded in those 30 days.

There are other ways but you still have to keep track of when the file was last downloaded.
 
It's probably the safest way. Though linux and other unixes have a last access time property, that time/date gets reset even for something as simple as a directory read.

Jeff
 
Back
Top