Re: Auto Delete EmailCompleted Files

This WebDNA talk-list message is from

2002


It keeps the original formatting.
numero = 45653
interpreted = N
texte = At 3:15 PM -0600 11/22/02, Donovan wrote: >No, but something like this should be close >(untested so you might need to debug): > >[text]fivedaysago=[math]{[date]}-5[math][/text] >[ListFiles path=../cgi-bin/WebCatalogEngine/EmailCompleted/] >[hideif [math]{[ModDate]}[/math]>[fivedaysago]] >[DELETEFILE file=../cgi-bin/WebCatalogEngine/EmailCompleted/[filename]] >[/hideif] >[/listfiles] > >Then set a trigger to hit this page every so often. The above script runs afoul of the dreaded delete while listing conundrum, resulting in only every-other file being deleted.If you have 6 files, named a, b, c, d, e and f, then do a listfiles, deleting each time through, you will delete file a on the first pass, then file c on the second pass because c will now be the second file in the list because a no longer exists. The third pass will delete file e, leaving the three files b, d and f.My preferred way of dealing with this situation is to stick the names of all the files to be deleted into a text variable, then, after the [/listfiles], do a [listwords] on the file list to delete the listed files.Also, a more portable way of accessing the EmailCompleted folder is to go to the globals folder then back up a level.Here's my version - and I just tested it successfully on my server, as I'd been meaning to do this anyway:[text]deletelist=[/text] [text]completed=^../EmailCompleted/[/text] [text]fivedaysago=[math]{[date]}-5[/math][/text] [ListFiles path=[completed]] [hideif [math]{[ModDate]}[/math]>[fivedaysago]] [text]deletelist=[deletelist],[filename][/text] [/hideif] [/listfiles] [listwords words=[url][deletelist][/url]&delimiters=,] [DELETEFILE file=[completed][word]] [/listwords] - brian -- <= Brian C. Fries, BrainScan Software http://www.brainscansoftware.com =>------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
At 3:15 PM -0600 11/22/02, Donovan wrote: >No, but something like this should be close >(untested so you might need to debug): > >[text]fivedaysago=[math]{[date]}-5[math][/text] >[ListFiles path=../cgi-bin/WebCatalogEngine/EmailCompleted/] >[hideif [math]{[ModDate]}[/math]>[fivedaysago]] >[DELETEFILE file=../cgi-bin/WebCatalogEngine/EmailCompleted/[filename]] >[/hideif] >[/listfiles] > >Then set a trigger to hit this page every so often. The above script runs afoul of the dreaded delete while listing conundrum, resulting in only every-other file being deleted.If you have 6 files, named a, b, c, d, e and f, then do a listfiles, deleting each time through, you will delete file a on the first pass, then file c on the second pass because c will now be the second file in the list because a no longer exists. The third pass will delete file e, leaving the three files b, d and f.My preferred way of dealing with this situation is to stick the names of all the files to be deleted into a text variable, then, after the [/listfiles], do a [listwords] on the file list to delete the listed files.Also, a more portable way of accessing the EmailCompleted folder is to go to the globals folder then back up a level.Here's my version - and I just tested it successfully on my server, as I'd been meaning to do this anyway:[text]deletelist=[/text] [text]completed=^../EmailCompleted/[/text] [text]fivedaysago=[math]{[date]}-5[/math][/text] [ListFiles path=[completed]] [hideif [math]{[ModDate]}[/math]>[fivedaysago]] [text]deletelist=[deletelist],[filename][/text] [/hideif] [/listfiles] [listwords words=[url][deletelist][/url]&delimiters=,] [DELETEFILE file=[completed][word]] [/listwords] - brian -- <= Brian C. Fries, BrainScan Software http://www.brainscansoftware.com =>------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Brian Fries

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

Banner DNA (1997) UPS (2003) [WebDNA] How to build a Ubuntu 18.04 server on DigitalOcean (2019) Checking two required fields (1998) Duplicate Carts (2000) RE: Problems reading files created by WC (1997) WebMerchant 3.0 for Mac shipping now (1998) Q: for those who use Cookies for sessions? (2004) Auto conversion of URLs? (1998) [OT] Democratic Code (2002) URL for Discussion Archive (1997) RE: completed orders database (1997) Character limit in [Search]? (1998) [protect] is protecting too much!!! (2000) formatting dates from a field ... (1997) Template Security error (1997) RE: Migrating to NT (1997) unable to run webcatalog locally (1998) Migrating to NT (1997) [WebDNA] Bug in [thisurlplusget] on v7 (2011)