Possible Duplicate:
Automatically delete files from webserver
I’m logging some XML content to a text file using file_put_contents() in case I need it for debugging.
How do I delete this file after a certain amount of time?
I’ve got a restrictive .htaccess in the log folder, but I’d rather not leave the info (will have customer’s addresses, etc) up on the web for long.
Well, while agreeing with everyone else that you’re using the wrong tool for the job, your question is pretty straightforward. So here you go:
cronor windows scheduled taskcronevery minute/five minutes/etcYour script would be pretty straightforward:
You could also use
findif you’re working in Linux, but I see that @Rawkode posted that while I was writing this so I’ll leave you with his elegant answer for that solution.