![]() |
Unix Guru - need your help
How can I set file to expire by themself ?
I'm creating files in PHP for download but once it has been downloaded I what the file to be destroyed. How can I do that ? Can I put an expiration date like time() + 3600; so the serveur would destroy the file an hour after creation ? Thanks a lot and Happy new year ! |
add a timestamp to the filename, and when you are creating a new file, see if there are any files that are older than n minutes. if so, delete it.
|
crontab this hourly
find /path/files/are/in/ -type f -mmin +60 -print replace the -print with -delete AFTER YOU HAVE VERIFIED it finds the right files to delete. |
thank you guys.
Do you know if the tmpfile function in PHP use the memory to create the file or does it write it on the HD ? This could fix my problem... |
All times are GMT -7. The time now is 01:53 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123