I have a bunch of CSV files that I wish to import into a table.  I can
do that with LOAD DATA INFILE INTO TABLE ......

but there's a bunch of them with different names (naturally) and I
wish to do them in one go.  From my understanding, there is no way to
specify the table since it is inferred from the name of the file.

Is there a smarter way to deal with this than making a shell script
that copies the CSV files in turn to a name that matches the table I
wish to add data to, and then use that name in a loop?

If my table is Bank, this will work:

for i in *CSV; do cp $i Bank.CSV; 
mysqlimport --fields-terminated-by=',' --ignore-lines=1 db_name Bank.CSV; 
done

Something tells me that greater minds have a better way.


-- 
   ___     Patrick Connolly      
 {~._.~}   
 _( Y )_          Good judgment comes from experience 
(:_~*~_:)         Experience comes from bad judgment    
 (_)-(_)            


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to