Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

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?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2020-10-26 19:43 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (253 votes). Check out past polls.