473,385 Members | 1,753 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Project Design Advice

Hello all. Thanks for reading and for any advice...

Ok, I have a linux webserver with php/mysql/apache.
Next, there are csv (comma separated values) log files on a user's
WINDOWS machine
(and not on the webserver)
in a local directory of theirs like so:

d:\reports\log_data2004_`\log_data_jan\log_file_ja n.txt
d:\reports\log_data2004_2\log_data_feb\log_file_fe b.txt
etc...
(The \reports\log_data\ has several subordinate folders with txt log
files in each...

Now, I need to get these csv text files from the user's windows machine
and onto the linux server and into mysql...
I am able to manually get a single log file into mysql using LOAD DATA
via the command line, however, I need a good way to load all log files
(from their subordinate folders on the windows box) into the database.

I cannot get (and don't think it works anyways) LOAD DATA to work from
a php script.

SHould I have them upload the individual log files ontoe linux box
and process them there?
And if so, what would be the best way to have php look in a directory
(once the files are on the linux box) and load these files into mysql ?

Any ideas?

Thanks very much!

Jul 17 '05 #1
1 1304
john wrote:
Hello all. Thanks for reading and for any advice...

Ok, I have a linux webserver with php/mysql/apache.
Next, there are csv (comma separated values) log files on a user's
WINDOWS machine
(and not on the webserver)
in a local directory of theirs like so:

d:\reports\log_data2004_`\log_data_jan\log_file_ja n.txt
d:\reports\log_data2004_2\log_data_feb\log_file_fe b.txt
etc...
(The \reports\log_data\ has several subordinate folders with txt log
files in each...

Now, I need to get these csv text files from the user's windows machine
and onto the linux server and into mysql...
I am able to manually get a single log file into mysql using LOAD DATA
via the command line, however, I need a good way to load all log files
(from their subordinate folders on the windows box) into the database.

I cannot get (and don't think it works anyways) LOAD DATA to work from
a php script.

SHould I have them upload the individual log files ontoe linux box
and process them there?
And if so, what would be the best way to have php look in a directory
(once the files are on the linux box) and load these files into mysql ?

Any ideas?

Thanks very much!

John,

If you can easily generate a list of the files you wish to load
(with full pathnames) and copy it to your Linux server the
easiest way to solve your problem is to use a text editor the
file to a set of LOAD DATA commands and then execute the file.

For example assume you are using the vi editor in Linux:

Step 1 create a file containing 1 file name to load per line:
d:\reports\log_data2004_`\log_data_jan\log_file_ja n.txt
d:\reports\log_data2004_2\log_data_feb\log_file_fe b.txt

Step 2 edit the file to convert each line into a LOAD DATA command:
:%s/.*/LOAD DATA INFILE "&" INTO TABLE my_table FIELDS
TERMINATED BY "," ENCLOSED BY "\\"";\

Step 3 save the edited file and execute it. (Assume you called
it loadfiles)

.. ./loadfiles

(The first dot says execute it even though it isn't defined as
being executable. The ./ says it is in the current directory.)

Step 4 QA the data to be sure that your load worked properly.
HTH

Jerry
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

41
by: Michael Strorm | last post by:
Hi, I'm in the middle of "teaching" myself C++. Having skimmed some of the "Teach Yourself C++ in 21 Days" book, I got a feel for the language, at least. Then I bought "The C++ Programming...
7
by: Phil Powell | last post by:
I am one of 95 people on a project bid (I do freelance on the side), and the potential buyer wants for each of us to produce a professional L&F mockup based upon an existing site...
24
by: sundew | last post by:
Hi all, I am developing an open source DHTML project named Wednus Window. http://wednus.com Wednus Window is a DHTML Web-Application Windowing System. It shell websites/web-applications with...
1
by: athos | last post by:
Hi all, Believe you have sound experience in development, however, if we look at the whole Software Development Life Cycle (SDLC) of the project, say, 1. Project Initiation, 2. Gathering...
31
by: Bob | last post by:
I have recently joined a healthcare company where I am the solo programmer. I am going to be starting work on a project. The management has asked me to provide an estimate of hours I am going to...
23
by: JoeC | last post by:
I am a self taught programmer and I have figured out most syntax but desigining my programs is a challenge. I realize that there are many ways to design a program but what are some good rules to...
6
by: mscertified | last post by:
I'm about to start my first Dot Net Project. It seems fairly simple but then I'm a neophyte. I've just taken a few dot.net courses and have some background in classic ASP. The application is...
11
by: maybetooparanoid | last post by:
Hello, I am now in the crucial moment I must choose one GUI platform for a new project, and would like to get some advice from experts. Details about my project: - source code is in C++ =GUI...
49
by: Martin Unsal | last post by:
I'm using Python for what is becoming a sizeable project and I'm already running into problems organizing code and importing packages. I feel like the Python package system, in particular the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.