Forum Moderators: phranque

Message Too Old, No Replies

Entering hundreds of jpg filenames as mysql records

Automated means to turn filenames in a directory into delimitted records

         

skateboard

6:20 am on Nov 18, 2004 (gmt 0)

10+ Year Member



I have a series of jpgs, whose file name's I want store as mysql records . The current format of the filenames is 206_2078.jpg. I need to ad around 500 roughly sequential filenames.

Does anyone know a way to do this without retyping each filename, or copying and editing filenames? Is there an automated names to take file names in a directory and turn them into comma delimited records? or some other delimitted format?

weird question I know, but entering all this data is a pain.
Thanks,

tomda

6:35 am on Nov 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi,

I got the link in this forum, do a search for a software called "Flashrenamer" and get the free trial. It can rename files in a second. Give it a try.

Otherwise, I sometimes use fro JPEG the batch process in Macromedia Fireworks.

Finally, last option is to make your own code in PHP/ASP or any server-side script using copying/reading/writing/directory commands.

instinct

11:00 am on Nov 18, 2004 (gmt 0)

10+ Year Member



If I understand correctly you just need to import the filenames to mysql?

Try this:

-start a (dos) command prompt in the directory where the files are
-type: dir *.jpg /b >filelist.txt
-now all the file names are in a file called 'filelist.txt'
-now import this text file into mysql using the "load data infile" command. (Google it for the proper syntax.)

Gernwax

12:21 pm on Nov 18, 2004 (gmt 0)

10+ Year Member



You could make an ASP script or something that loops throught the directory and gets the file names then inserts them into the DB, it would probably be about 10 lines of code or something, i like the text file method mentioned above tho, do that if you have the access to the DB to do it.

skateboard

6:33 pm on Nov 18, 2004 (gmt 0)

10+ Year Member



Much thanks,
I ran instinct's command line script, imported the filelist.txt into access via get external data, and ODBC'ed it to mysql table. Smooth as can be. Thanks a million for all your suggestions, you saved me 4-6 hours today.
Very grateful.
K