WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-22-2004, 05:16 PM
WebProWorld Pro
 

Join Date: May 2004
Location: Austin, TX
Posts: 199
steve0 RepRank 0
Default Looking for a lil scripting help

Not sure if anyone can rise to the challenge.. <*wink* *nod*>
but I have a task and I am looking for a little help.

I have several thousand JPEG files that needed to be renamed to match a part number that is embedded in a corresponding html file.

e.g.
jpeg file is "product_image_982.jpg"
textfile is "product982.html"

within "product982.html" is ZR242A

The task is
product_image_982.jpg ==> ZR242A.jpg

There is no corresponding db that created the mess..
All I have is imagefile#.jpg and product#.html.

Most methodologies and combination of methods considered.. (preferably non-manual)

Any ideas??

-steve
__________________
Hardcore Programming Solutions and Coffee Drinker
Reply With Quote
  #2 (permalink)  
Old 10-22-2004, 06:28 PM
Maximilian's Avatar
WebProWorld Veteran
 

Join Date: Sep 2004
Location: Las Vegas
Posts: 570
Maximilian RepRank 0
Default Re: Looking for a lil scripting help

Quote:
Originally Posted by steve0
I have several thousand JPEG files that needed to be renamed to match a part number that is embedded in a corresponding html file. Any ideas??
Greetings - steve0!

I do not envy you this task in that there are no constants, save the .jpg & .html, and all product SKUs are different variables. I see no other alternative, but manual cut 'n past for your daunting job - sorry!

Cheers!
Max
__________________
Maximilian
Maximum Beauty Products Supply Stores
Reply With Quote
  #3 (permalink)  
Old 10-23-2004, 05:51 PM
WebProWorld Pro
 

Join Date: May 2004
Location: USA
Posts: 101
morpheus.100 RepRank 0
Default

within "product982.html" is ZR242A

What you dont explain is the relation of the zr No to the product No

If a script generated these filenames then it would have worked on an algorithm or a last insert id. Post some more relationship examples to see if any patter exists.

Another option maight be to get in touch with a user php~pro. I gave him thousands of pages of csv and he filed all this into a great relational database for my new mapping application. He works for a bank also and should have a head for the figures.
Reply With Quote
  #4 (permalink)  
Old 10-26-2004, 06:37 PM
WebProWorld New Member
 

Join Date: Oct 2003
Location: Dubai
Posts: 4
keithme RepRank 0
Default

Hi,

Depends on the code within "productxxx.html".

I imagine it is of a similar format throughout though.

If you look at my last posting you will see all the program tools I have, these are precisely for this type of task (HATE doing things manually too!!).

Basic way I would do this is..

1. Put all the jpg's in one directlory.

2. Use Directory toolkit to get a text listing of them.

3. Take the html files, convert to pure TEXT.

4. Concatenate all the above into ONE file.

5. Take above one file into word (TEXT so it doesn't open as a HTML file).

6. Suitable edit/replaces to get the lines with file image names ONLY left (this is def an art not a science.. would need some trial and error to achieve and probaly use of Excel in the middle after several converts to a table in Word... could only advise if saw the html files themselves..)

7. From above end up with a list of just the Part Numbers referring to the jpg's IN THE SAME SEQUENCE/SORT ORDER as the list of jpg's in 2 above.

8. Use Textpad "Block Select Mode" to create a file which would have command line rename commands for all the files in 1 above.

9. Find a command line program which will run 8 on 2 above to rename all the files.

(10. Optional.. produce an xls or access file which would have a look-up of the old jpg to the new "part_number.jpg" files "just in case" you ever need to use this in any of your programming etc in future...

IN FACT... you could use 10 above as a look up table from the old to new file names to use in whatever you are doing rather than actually renaming all the jpg's if you wanted to.. just a thought..

The art in the above would be in lines 6 and 9, all the rest is "easy" (I seem to do this type of stuff all the time, don't know why).

Send me some samples of your files and perhaps I could have a quick look and see how feasible the above sequence actually is... the format of the html files and where the Part Numbers are buried will be the key...

Hope that helps

:-)
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: , ,



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0