strange problem listfiles and movefile (long)

This WebDNA talk-list message is from

2000


It keeps the original formatting.
numero = 27945
interpreted = N
texte = TyphoonPro v3.0.7, WebStar 4.1, MacOS 9 Following is the code used to move some newly uploaded images to the proper place on my server based on information in a database.What happens is that if there are 200 images in the folder this template only moves about 120 of them and stops - no error messages or anything, it simply moves a little over half of the images each time.I am sure it is something I am doing incorrectly.I put the images in a folder, use listfiles to read the filename and then strip the '.jpg' off the end. The filename is now the same as the record ID in the database. I search the database, if there is a match, I create (if it doesn't exist) a folder hierarchy based on the country, state (if there is a state) and city. The move the image there and update the database with this new path.The second thing that I haven't yet been able to figure out is that if the city name ends with a period, the folders are created, but the image is moved to the state (or country if no state) folder and has the name of [city][file]I also move any images that do not find a match in the database to a no_match folder for other processing / deleting.You may notice one database with ^ and the other without. This is correct as the original database is in the globals folder (due to the previous problem of addressing with virtual domains etc) and the logging database is in the local virtual domain.Any suggestions for optimizing what I have would be appreciated. I will eventually add more error checking and will move the old images out of the existing folder structure, but that will require a database change from how it is currently setup (which I am also int he process of doing).Thank you for any suggestions.----------[Listfiles newimages] [hideif [isfolder]=t] [text]path=[fullpath][/text][text]pic_name=[getchars start=5&from=end][FileName][/getchars][/text][text]file=[FileName][/text] [/hideif][search db=^databases/members.db&eqRecord_idData=[pic_name]] [founditems] [showif [fileinfo /pics/[country]/][exists][/fileinfo]=F] [createfolder /pics/[country]] [/showif][showif [state]!] [showif [fileinfo /pics/[country]/[state]][exists][/fileinfo]=F] [createfolder /pics/[country]/[state]] [/showif] [/showif][showif [state]!] [showif [fileinfo /pics/[country]/[state]/[city]][exists][/fileinfo]=F] [createfolder /pics/[country]/[state]/[convertchars][city][/convertchars]] [/showif] [/showif][showif [state]=] [showif [fileinfo /pics/[country]/[url][city][/url]][exists][/fileinfo]=F] [createfolder /pics/[country]/[convertchars][city][/convertchars]] [/showif] [/showif] [showif [state]!] [movefile path=[path]&to=/pics/[country]/[state]/[city]/[file]][Append db=/databases/added_images.db]update_id=[cart]&record_id=[record_id]&date_ad ded=[date]&date_addedS=[Math]{[date]}[/Math]&existing_pic=[pic_filename][/Ap pend] [Replace db=^databases/members.db&eqRecord_IDdata=[record_id]]pic_filename=[country]/ [state]/[city]/[file]&date_updated=[date]&pic_height=&pic_width=&TimeUpdate= [time][/Replace][/showif] [showif [state]=] [movefile path=[path]&to=/pics/[country]/[city]/[file]][Append db=/databases/added_images.db]update_id=[cart]&record_id=[record_id]&date_ad ded=[date]&date_addedS=[Math]{[date]}[/Math]&existing_pic=[pic_filename][/Ap pend] [Replace db=^databases/members.db&eqRecord_IDdata=[record_id]]pic_filename=[country]/ [city]/[file]&date_updated=[date]&pic_height=&pic_width=&TimeUpdate=[time][/ Replace][/showif][/founditems][showif [numfound]=0] [createfolder newimages/no_match] [movefile from=[path]&to=newimages/no_match/[file]] File at [path], moved to=newimages/no_match/[file]
[/showif] [/search][/listfiles] ------------------------------------------------------------- Brought to you by CommuniGate Pro - The Buzz Word Compliant Messaging Server. To end your Mail problems go to .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 Associated Messages, from the most recent to the oldest:

    
  1. Re: strange problem listfiles and movefile (long) (Kenneth Grome 2000)
  2. Re: strange problem listfiles and movefile (long) (Dale Therio 2000)
  3. Re: strange problem listfiles and movefile (long) (Kenneth Grome 2000)
  4. strange problem listfiles and movefile (long) (Dale Therio 2000)
TyphoonPro v3.0.7, WebStar 4.1, MacOS 9 Following is the code used to move some newly uploaded images to the proper place on my server based on information in a database.What happens is that if there are 200 images in the folder this template only moves about 120 of them and stops - no error messages or anything, it simply moves a little over half of the images each time.I am sure it is something I am doing incorrectly.I put the images in a folder, use listfiles to read the filename and then strip the '.jpg' off the end. The filename is now the same as the record ID in the database. I search the database, if there is a match, I create (if it doesn't exist) a folder hierarchy based on the country, state (if there is a state) and city. The move the image there and update the database with this new path.The second thing that I haven't yet been able to figure out is that if the city name ends with a period, the folders are created, but the image is moved to the state (or country if no state) folder and has the name of [city][file]I also move any images that do not find a match in the database to a no_match folder for other processing / deleting.You may notice one database with ^ and the other without. This is correct as the original database is in the globals folder (due to the previous problem of addressing with virtual domains etc) and the logging database is in the local virtual domain.Any suggestions for optimizing what I have would be appreciated. I will eventually add more error checking and will move the old images out of the existing folder structure, but that will require a database change from how it is currently setup (which I am also int he process of doing).Thank you for any suggestions.----------[Listfiles newimages] [hideif [isfolder]=t] [text]path=[fullpath][/text][text]pic_name=[getchars start=5&from=end][FileName][/getchars][/text][text]file=[FileName][/text] [/hideif][search db=^databases/members.db&eqRecord_idData=[pic_name]] [founditems] [showif [fileinfo /pics/[country]/][exists][/fileinfo]=F] [createfolder /pics/[country]] [/showif][showif [state]!] [showif [fileinfo /pics/[country]/[state]][exists][/fileinfo]=F] [createfolder /pics/[country]/[state]] [/showif] [/showif][showif [state]!] [showif [fileinfo /pics/[country]/[state]/[city]][exists][/fileinfo]=F] [createfolder /pics/[country]/[state]/[convertchars][city][/convertchars]] [/showif] [/showif][showif [state]=] [showif [fileinfo /pics/[country]/[url][city][/url]][exists][/fileinfo]=F] [createfolder /pics/[country]/[convertchars][city][/convertchars]] [/showif] [/showif] [showif [state]!] [movefile path=[path]&to=/pics/[country]/[state]/[city]/[file]][Append db=/databases/added_images.db]update_id=[cart]&record_id=[record_id]&date_ad ded=[date]&date_addedS=[math]{[date]}[/Math]&existing_pic=[pic_filename][/Ap pend] [Replace db=^databases/members.db&eqRecord_IDdata=[record_id]]pic_filename=[country]/ [state]/[city]/[file]&date_updated=[date]&pic_height=&pic_width=&TimeUpdate= [time][/Replace][/showif] [showif [state]=] [movefile path=[path]&to=/pics/[country]/[city]/[file]][Append db=/databases/added_images.db]update_id=[cart]&record_id=[record_id]&date_ad ded=[date]&date_addedS=[math]{[date]}[/Math]&existing_pic=[pic_filename][/Ap pend] [Replace db=^databases/members.db&eqRecord_IDdata=[record_id]]pic_filename=[country]/ [city]/[file]&date_updated=[date]&pic_height=&pic_width=&TimeUpdate=[time][/ Replace][/showif][/founditems][showif [numfound]=0] [createfolder newimages/no_match] [movefile from=[path]&to=newimages/no_match/[file]] File at [path], moved to=newimages/no_match/[file]
[/showif] [/search][/listfiles] ------------------------------------------------------------- Brought to you by CommuniGate Pro - The Buzz Word Compliant Messaging Server. To end your Mail problems go to .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 Dale Therio

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:

debit cards and checksum (1998) Multiple prices (1997) unable to launch acgi in WebCat (1997) Hiding HTML and breaking the page (1997) WC2b15 File Corruption (1997) [Sum] function? (1997) [WebDNA] Was: wiki Now: Object-oriented programmng (2009) refreshing IE with posted .tmpl (1997) REPOST: Overwiting SKU in Cart (2002) Error Lob.db records error message not name (1997) WebCat2b13MacPlugIn - [showif][search][/showif] (1997) Summing fields (1997) textA and Title? (1997) Copy and paste text into form fields....... (2005) Sort Order on a page search (1997) Major Security Hole IIS NT (1998) webdna+post+WinIE6 (2004) Requiring that certain fields be completed (1997) Looking for a Manual (1997) selecting multiple found items (1997)