You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Brian Doyle <li...@balancesoftware.com> on 2002/09/13 23:19:38 UTC

[users@httpd] How to delete a file after it's been served?

Can anyone tell me how to delete a file from the server immediately after
it's been served?

I'd like to serve a client-specfic file (created in a temporary directory by
a CGI) then delete it once it's been served.

TIA,

Brian Doyle


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] How to delete a file after it's been served?

Posted by go...@cheapgurus.com.
9/13/02 4:56:44 PM, Brian Doyle <li...@balancesoftware.com> wrote:

>Thanks but this doesn't meet my criteria...  I know how to delete a file, I
>guess I'm more interested in being notified that the file has been served.
>
>In other words, can apache signal me somehow (with the filename preferably)
>so that I can then delete the file.
>
>Thanks,
>
>Brian
>
>On 09.13.02 2:43 PM, "Jacob Coby" <jc...@listingbook.com> wrote:
>
>>> Can anyone tell me how to delete a file from the server immediately after
>>> it's been served?
>>> 
>>> I'd like to serve a client-specfic file (created in a temporary directory
>> by
>>> a CGI) then delete it once it's been served.
>> 
>> depends on the language.  most have an unlink() or exec() function that will
>> do what you want.  You have to have permissions to delete it though.
>> 
>> Another option is to cron a job to clean up the directory every 10 min or
>> so.
>> 
>> -Jacob
>> http://www.listingbook.com
>> 
>> 


Hi, Brian!

Assuming that the client-specific file is some form of HTML document, and since it's already being created by a 
CGI, here's what I'd do.

1. Have the creating CGI - which obviously knows the name of the file it is creating - write a line just before the 
closing body tag that looks like this:

<!--#include virtual="/cgi-bin/eraser.cgi?served=clientfilename" -->

2. Create eraser.cgi to delete the file, maybe logging some info about when served, and outputting a thank you, 
copyright notice, disclaimer, or maybe a brief message to the client to remind them that now that they've seen 
it, it's gone. Or the eraser could email you that such and such file was served, etc. It could do just about 
anything.

Of course, if it's some other type of file, it's a different problem, but maybe this will give you some ideas.

Cindy






---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] How to delete a file after it's been served?

Posted by "John K. Sterling" <jo...@sterls.com>.
Hi -

Couldn't you simply install a cleanup on the request pool?  That 
cleanup function could delete the file.

sterling

On Friday, September 13, 2002, at 05:56 PM, Brian Doyle wrote:

> Thanks but this doesn't meet my criteria...  I know how to delete a 
> file, I
> guess I'm more interested in being notified that the file has been 
> served.
>
> In other words, can apache signal me somehow (with the filename 
> preferably)
> so that I can then delete the file.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] How to delete a file after it's been served?

Posted by Brian Doyle <li...@balancesoftware.com>.
Thanks but this doesn't meet my criteria...  I know how to delete a file, I
guess I'm more interested in being notified that the file has been served.

In other words, can apache signal me somehow (with the filename preferably)
so that I can then delete the file.

Thanks,

Brian

On 09.13.02 2:43 PM, "Jacob Coby" <jc...@listingbook.com> wrote:

>> Can anyone tell me how to delete a file from the server immediately after
>> it's been served?
>> 
>> I'd like to serve a client-specfic file (created in a temporary directory
> by
>> a CGI) then delete it once it's been served.
> 
> depends on the language.  most have an unlink() or exec() function that will
> do what you want.  You have to have permissions to delete it though.
> 
> Another option is to cron a job to clean up the directory every 10 min or
> so.
> 
> -Jacob
> http://www.listingbook.com
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>  "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] How to delete a file after it's been served?

Posted by Jacob Coby <jc...@listingbook.com>.
> Can anyone tell me how to delete a file from the server immediately after
> it's been served?
>
> I'd like to serve a client-specfic file (created in a temporary directory
by
> a CGI) then delete it once it's been served.

depends on the language.  most have an unlink() or exec() function that will
do what you want.  You have to have permissions to delete it though.

Another option is to cron a job to clean up the directory every 10 min or
so.

-Jacob
http://www.listingbook.com


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org