--- In cgiclub@y..., sjohnston40 wrote:
> Hi, I was just wondering how one would go about auto-deleting .txt files from the server once they reach X number of days old.
Thanks,
~Steve~
If you have CMUCL or any other decent Common LISP available on your system,
use (directory "*.txt") to make a list of all *.txt files, map down that
list with file-write-date, compare that with the current date&time which
you can get from get-universal-time, and then optionally call delete-file.
To make CMUCL runnable as a CGI application, make a little shell script
that simply passes control to it with the appropriate commandline
parameter/argument to make it load any needed files then run the actual
program then quit the LISP environment entirely.
For example, one of my CGI/CMUCL demos basically does this:
#! /bin/sh
/usr/local/bin/lisp -eval '(progn (load "cgiwordhist.lisp" :verbose nil) (cgi-wordhist-disp) (quit))'
Note that any other files needed get auto-loaded from inside the function
cgi-wordhist-disp, which of course was defined in cgiwordhist.lisp.