Re: Any help gratefully appreciated

This WebDNA talk-list message is from

2001


It keeps the original formatting.
numero = 39798
interpreted = N
texte = on 10/31/01 9:56 am, Laeg Ent. at laeg_enterprises@yahoo.co.uk so noted...> --- dale wrote: > It is not > safe to delete files within a listfiles. >> >> When you use listfiles it counts all the files, so >> if you have 10 files, >> then delete one, listfiles still thinks you have 10, >> which is why they do >> not delete as you think they should. > > Is it not ok in this case as the deleting is done > outside of the listfiles????The problem is that you're deleting records from your database within your [founditems] loop. You'd have to move the deletion outside.This should remove any entry in filelist.db that *doesn't* appear as a file in /orders:[math show=f]delTotal=0[/math][listfiles path=orders] [showif [lookup db=orders/filelist.db&value=[filename]&lookInField=[filenames]&returnField=[ filenames]¬Found=]=] [math show=f]delTotal=[delTotal]+1[/math] [text]delFile[delTotal]=[filename][/text] [/showif] [/listfiles][loop start=1&end=[delTotal]] [delete db=orders/filelist.db&eqFILENAMESdata=[text]delFile[index][/text]] [/loop] A couple side notes:> [search > db=orders/filelist.db&neFILENAMESdatarq=find_all&rank=on]Parameters within WebCat commands shouldn't be quoted. Also, there's no rank=on. Use rank=off to return results in the same order they appear in the database.> [text]doDelete=[F][/text]If you're setting text variables to use as booleans, I'd recommend using T and F instead of [T] and [F].> [If [filenames]=[filename]] > [then] > [text]doDelete=[T][/text] > [/then] > [else] > [/else] > [/If]If you're not needing it, the [else] is optional. And for simple does this equal this comparisons, [showif] is your friend! : )> [delete > db=orders/filelist.db&eqFILENAMESdatarq=[filenames]] > [FlushDatabases] > [/founditems][FlushDatabases] is going to commit and close *all* databases open on your server. If you don't have Commit Databases set to automatic in your WebCat preferences, you might want to just put a [commitdatabase db=orders/filelist.db] in there instead (outside the [founditems]) to commit just that one database yet still leave it open in RAM. Do a [closedatabase db=orders/filelist.db] if you want the database removed from RAM as well. Rob Marquardt Designer/Resident Wirehead Toast Design800 Washington Avenue North Minneapolis MN 55401 612.330.9863 v 612.321.9424 f http://www.toastdesign.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://search.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: Any help gratefully appreciated (Rob Marquardt 2001)
  2. Re: Any help gratefully appreciated (Laeg Ent. 2001)
  3. Re: Any help gratefully appreciated (Rob Marquardt 2001)
  4. Re: Any help gratefully appreciated (dale 2001)
  5. Re: Any help gratefully appreciated (Laeg Ent. 2001)
  6. Re: Any help gratefully appreciated (Laeg Ent. 2001)
  7. Re: Any help gratefully appreciated (dale 2001)
  8. Any help gratefully appreciated (Laeg Ent. 2001)
on 10/31/01 9:56 am, Laeg Ent. at laeg_enterprises@yahoo.co.uk so noted...> --- dale wrote: > It is not > safe to delete files within a listfiles. >> >> When you use listfiles it counts all the files, so >> if you have 10 files, >> then delete one, listfiles still thinks you have 10, >> which is why they do >> not delete as you think they should. > > Is it not ok in this case as the deleting is done > outside of the listfiles????The problem is that you're deleting records from your database within your [founditems] loop. You'd have to move the deletion outside.This should remove any entry in filelist.db that *doesn't* appear as a file in /orders:[math show=f]delTotal=0[/math][listfiles path=orders] [showif [lookup db=orders/filelist.db&value=[filename]&lookInField=[filenames]&returnField=[ filenames]¬Found=]=] [math show=f]delTotal=[delTotal]+1[/math] [text]delFile[delTotal]=[filename][/text] [/showif] [/listfiles][loop start=1&end=[delTotal]] [delete db=orders/filelist.db&eqFILENAMESdata=[text]delFile[index][/text]] [/loop] A couple side notes:> [search > db=orders/filelist.db&neFILENAMESdatarq=find_all&rank=on]Parameters within WebCat commands shouldn't be quoted. Also, there's no rank=on. Use rank=off to return results in the same order they appear in the database.> [text]doDelete=[F][/text]If you're setting text variables to use as booleans, I'd recommend using T and F instead of [T] and [F].> [If [filenames]=[filename]] > [then] > [text]doDelete=[T][/text] > [/then] > [else] > [/else] > [/If]If you're not needing it, the [else] is optional. And for simple does this equal this comparisons, [showif] is your friend! : )> [delete > db=orders/filelist.db&eqFILENAMESdatarq=[filenames]] > [flushdatabases] > [/founditems][flushdatabases] is going to commit and close *all* databases open on your server. If you don't have Commit Databases set to automatic in your WebCat preferences, you might want to just put a [commitdatabase db=orders/filelist.db] in there instead (outside the [founditems]) to commit just that one database yet still leave it open in RAM. Do a [closedatabase db=orders/filelist.db] if you want the database removed from RAM as well. Rob Marquardt Designer/Resident Wirehead Toast Design800 Washington Avenue North Minneapolis MN 55401 612.330.9863 v 612.321.9424 f http://www.toastdesign.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://search.smithmicro.com/ Rob Marquardt

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:

Norton Internet Security filtering out WebDNA processsed pages (2004) Multi-processor Mac info ... (1997) WCS Newbie question (1997) Dates! (1998) sort problems....bug or brain fart? (1997) 2nd WebCatalog2 Feature Request (1996) WordBreak Qestion (part 2) (1998) WebDNA-Talk Digest mode broken (1997) webcat (2000) a search based on ^(contains) (1998) [WebDNA] Apache 2 Error Log Entry (2009) New Site Announcement (1998) Email within tmpl ? (1997) Comments in db? (1997) Severe Slowness (2005) Cart Question (1998) Not really WebCat (1997) Webcat 2.0.1 date math bug -> Crash! (1997) Re:E-Mailer (WebCatb15acgiMac) (1997) WC2b12: Yes, Formulas.db is for real (1997)