NamePros.Com (http://www.namepros.com/)
-   CODE (http://www.namepros.com/code/)
-   -   Parsing Windows Files/Dir into Mysql (http://www.namepros.com/code/112027-parsing-windows-files-dir-into-mysql.html)

KwelX 08-02-2005 12:39 PM

Parsing Windows Files/Dir into Mysql
 
I have some dirs and html files and would like to parse them into a mysql db.

What I would like to do is pull the directory names into a category table, place the contained files into subtables under each dir. then pull data from the html files into tables. such as the h1 data and body onto seperate tables.

Does this make sense and is this possible?

This is what I want to do in a nutshell:

DIR-HTML PAGES
into:
Category
|
File ID - Title - Body
File ID - Title - Body
File ID - Title - Body

However I have several DIR-and 100's of HTML pages. There is a naming convention of the HTML pages that can be used as the File ID.

If anyone has done this or knows how please point me in the right direction for software or a script.

Thanks.

monaco 08-02-2005 01:20 PM

I would do this in Java with JDBC using mysql Connector/J for the database connectivity.

Pick a directory root, run a recursive breadth-first search to enumerate all the files with full pathnames, parse it to your liking, then insert into the db. I did something similar to this, I'll post the source code if I can find it.

KwelX 08-02-2005 01:48 PM

awesome..thanks.

i'll google it tonight and see what i can do.

Refrozen 08-02-2005 09:36 PM

It wouldn't be too hard to do with PHP5's directory recurser either, may I ask why you want to do this?

monaco 08-02-2005 10:05 PM

To do it in php, he'd need to install php, apache/iis, and use a browser to do everything, with no debugger/stepping support.

With java, he just needs to download a jarfile from mysql for the db connector.


All times are GMT -7. The time now is 04:48 PM.
Site Sponsors
Advertise your business at NamePros

Powered by: vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0