Re: temp file deletion strategies?

From: Date: Thu, 16 Nov 2000 05:50:08 +0000
Subject: Re: temp file deletion strategies?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-25619@lists.php.net to get a copy of this message
I'm thinking about this, and it's not quite what I need... I've got several files, and I only want to delete the _temporary_ files, not everything that's older than xxx minutes. How about if I created a directory named something like 'recycle' and placed a link (ln) to each of the temp files there. It's been a while since I worked with links, so I'm wondering... if I delete the target file, does the link go away? If I do something like what you suggest (with a find command), will it use the timestamp of the link or of the target file? (I've got a web account where the sysadmin created a link in my home dir to my web log file and the date that always shows up is the creation date of the link, rather than the modified time of the target file.) This way, I could have one of my regular scripts check the recycle dir for 'old' files and delete them via their link. Would this work? -David jeremy brand wrote: > you might just want to run a cron job.. something like this... > > #!/bin/sh > for i in find /your/path -ctime -1 -print > do > rm -f "$i" > done > > This would remove files that were created up to 1 day (-ctime -1). > > (also see -cmin if you want minutes...) > > -jeremy brand > > http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html for > more > --------------------------------------------------------------------- > We cannot do everything at once, but we can do something at once. > -- Calvin Coolidge > > On Wed, 15 Nov 2000, David P. Schwartz wrote: > > > Date: Wed, 15 Nov 2000 00:07:25 -0700 > > From: David P. Schwartz <davids@desertigloo.com> > > To: "php-general@lists.php.net" <php-general@lists.php.net> > > Subject: [PHP] temp file deletion strategies? > > > > If I send a temporary file to a client like this: > > > > $tempfile = create_file_somehow(...); > > header( "Content-type: application/octet-stream" ); > > header( "Location: $tempfile" ); > > > > What sort of strategies exist to make sure that the $tempfile gets deleted? Do > > I get control back after the second header executes? > > > > I'm thinking about situations where client-side caching is disabled and the same > > file needs to be created over and over (in my case, it will always have the same > > name each time it's created). Giving it a lifetime of an hour or so would be > > handy, but it needs to get deleted eventually. > > > > Thanks > > -David > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > >

« previous php.general (#25619) next »