Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Temp file strategy

by samizdat (Vicar)
on Sep 15, 2005 at 17:56 UTC ( #492359=note: print w/replies, xml ) Need Help??


in reply to Temp file strategy

I use the following to keep webserver-generated links (and files) valid for three hours:
#[snip]# # Finally, remove old spreadsheets from temporary directory opendir(TMPD, $tmpdir) or die "No tmp Directory! $! \n"; while (my $f = readdir(TMPD)) { if ($f =~ /\.xls$/) { if ((-A "$tmpdir/$f") > 0.125) # if file is older than 3 hours, de +lete it { system('rm', '-f', "$tmpdir/$f") && die "Can't remove $f: $!\n"; } } } closedir(TMPD); #[snip]#
The files and the directory need to be writable by the webserver, but since earlier incarnations of the same page create them, that is not a problem.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://492359]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2019-10-22 04:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?