I was wondering if any of you could help me out. Ive had a browse through the forums to see if this topic was here....but if i have missed it please excuse me.
I am looking for a script where after a users download has finished, the file they just downloaded is deleted from the server.
Or
A Cron job that would purge a certain directory after the file is (x)minutes old.
Is any of this possible or am i in dream land?
Thankyou in advance & i await any responce anybody has to offer,
§talka
I dont see why it wouldnt be possible.
The cron would be simple, you could just look at the date/time created on the file and nuke if older than x.
You may be able to do it when someone downloads as well, you would need to find out if the download has finished and then nuke.
What language are you looking for?
Other than that jatar_k's right cron would be easy to setup.
Thankyou for the fast reply's.
I would like the language to be PHP if possible although i would consider anything else that would do the job.
--Jatkar_k, would the date/time creation of the file be possible as the file is currently being copied into a public area of my site from an "off tree" directory to allow download. Would the date/time be that of the original file or that of the time/date it was copied?
--BCMG_Scott
unlink($filename); ....i am not familiar with this command :-( ..can you offer any more help please?
§talka
in php
unlink() [php.net]
unlink('/tmp/upload_123.gif');
Then the file /tmp/upload_123.gif will be deleted. You can find more documentation on it at php.net under their online document (or search for unlink).
Scott