GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Unix Guru - need your help (https://gfy.com/showthread.php?t=558981)

qw12er 01-01-2006 10:22 AM

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 !

etech 01-01-2006 11:28 AM

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.

hive 01-01-2006 11:40 AM

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.

qw12er 01-01-2006 11:53 AM

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