dynamically generating temporary files through python/cgi

Michael Hoffman cam.ac.uk at mh391.invalid
Thu Apr 28 05:46:29 EDT 2005


poisondart wrote:

> I've seen it on certain websites that will
> generate a file under certain parameters (through forms) that will
> dissapear (i.e. delete itself) after a specified amount of time...
> 
> Is there a group of library functions that allow this?

No.

The easiest way, in my mind would be to store the files in a directory 
according to the hour they were requested, for example, a file generated 
between 2 p.m. and 3 p.m. today:

http://www.example.com/temp/20050428T14/d41d8cd98f00b204e9800998ecf8427e.html

Then you can have a cron job that runs every hour that deletes 
everything in the temp directory generated 24 hours ago.
-- 
Michael Hoffman



More information about the Python-list mailing list