My website allows a user to extract data to create a number of spreadsheet files, which are then zipped-up into a uniquely-named self-extracting .exe file which the user can download onto their pc (hopefully immediately). Because each file will be unique to that user, I would like it to be deleted from the server once downloaded. How can I arrange this from within my script files?

Because of the stateless nature of the web I don't think I can interrupt script execution while the file downloads, then delete the file programmatically. Can I?

I guess I could run a batch file via the Windows scheduler to regularly clear-out the download folder, but is there any way I can fire a Foxpro program (perhaps via. a timer control) while the channels are waiting for a web-hit? Alternatively, can I set a program to run just before the session.timeout takes effect?