Re: Auto Delete EmailCompleted Files
This WebDNA talk-list message is from 2002
It keeps the original formatting.
numero = 45655
interpreted = N
texte = I wouldn't call it a bug, more of a confusing yet not unexpected behavior if you think it through. Similar problems happen if you use [delete] inside a [founditems] to delete selected records from a database. If you mess with the control set for a loop, you can expect your loop to be messed with, regardless of the programming environment. Nevertheless, it has lead to many a confused programmer - you'd probably find dozens of topics related to this in the archives if you searched carefully.As for the date test, it worked fine for me - I have only the messages from the last 5 days in my completed folder (135 of the original 2000 or so).One possibility: when you look at the [moddate] from a fileinfo, are you getting a 2- or 4-digit year? It could be your system is set up to display 2-digit years, and therefore WebDNA thinks all the files were created in 1902, which is more than 60 days ago.I believe that on a Mac (classic), this date format comes from the Date & Time control panel -> date formats -> Show Century for short date. I don't know about other systems.- brianAt 4:55 PM -0600 11/22/02, Donovan wrote:>wierd, I confirmed this with my code.>could this be considered a bug? seems illogical to me.>>just to note, I tested brian's code with one modification. I have>completed emails dating back to august. I decided that>I would delete everything that is two months old or older.>I changed 5 to 60. the result was that all my completed>emails are gone (not a big deal as we have redundant>backups as well as they are not needed).>>Any ideas?>>at any rate, now I have a clean completed emails folder and>some new insight into the listfiles context. :-)>>cheers,>Donovan>>>>Brian Fries wrote:[snip]>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:
I wouldn't call it a bug, more of a confusing yet not unexpected behavior if you think it through. Similar problems happen if you use [delete] inside a [founditems] to delete selected records from a database. If you mess with the control set for a loop, you can expect your loop to be messed with, regardless of the programming environment. Nevertheless, it has lead to many a confused programmer - you'd probably find dozens of topics related to this in the archives if you searched carefully.As for the date test, it worked fine for me - I have only the messages from the last 5 days in my completed folder (135 of the original 2000 or so).One possibility: when you look at the [moddate] from a fileinfo, are you getting a 2- or 4-digit year? It could be your system is set up to display 2-digit years, and therefore WebDNA thinks all the files were created in 1902, which is more than 60 days ago.I believe that on a Mac (classic), this date format comes from the Date & Time control panel -> date formats -> Show Century for short date. I don't know about other systems.- brianAt 4:55 PM -0600 11/22/02, Donovan wrote:>wierd, I confirmed this with my code.>could this be considered a bug? seems illogical to me.>>just to note, I tested brian's code with one modification. I have>completed emails dating back to august. I decided that>I would delete everything that is two months old or older.>I changed 5 to 60. the result was that all my completed>emails are gone (not a big deal as we have redundant>backups as well as they are not needed).>>Any ideas?>>at any rate, now I have a clean completed emails folder and>some new insight into the listfiles context. :-)>>cheers,>Donovan>>>>Brian Fries wrote:[snip]>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:
WebCat2_Mac RETURNs in .db (1997)
snicker, snicker (1997)
[WebDNA] PGP Encrypted Emails using [sendmail] (2009)
WebCat on Intel Core 2 macs anyone? (2007)
On AOL Account Security: Fwd: POSSIBLE PROBLEMS FOR AOL USERS (1998)
[WebDNA] Off topic: ImageMagick (2008)
New WebCatalog Version !!! (1997)
WebMerchant - MacAuthorize (1999)
How to get shownext to just shownext once (1997)
Swear words (2002)
Languages (1997)
Cleaner URLs (2003)
PCS Frames (1997)
Frames and cart values (1998)
users change an email address (2002)
$Replace with [founditems] (1997)
Looking For WebCatalog Migration Assistance (2003)
Sort Order on a page search (1997)
[/application] error? (1997)
[Announce]: Web server security and password protection (1997)