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:

Variable Prices (1998) OT - ImageMagick on MacOS X (2004) encrypt/decrypt problems (2001) Single Link browsing (1997) So many lookers, hey smith micro (2003) emailer stuck (1997) Caching [include] files ... (1997) [format] problem (2001) WebStar WebCat Crashing a lot (2004) Verifying both name and password (was: THANKS) (1997) Help needed! (1998) Change History for Win 4.0.1 (2000) Cancel Subscription (1996) Pithy questions on webcommerce & siteedit (1997) Weird problems with [SHOWIF]s (1997) Database Helper missing? (2000) Forcing a NEWCART (1997) Generating Report Totals (1997) quotes and truncating? (1997) RE: [WebDNA] Still having problems (2008)