php - Importing multiple files into MySQL table -
this question has answer here:
i trying import bunch of text files(3098) mysql table. there no problem importing single file load data local infie
. files in 1 folder. reckon need use foreach not sure how it.is possible without php. helpful.
run following shell script
for f in /path/to/files/folder/*.txt mysql -e "load data infile '"$f"' table [tablename] fields terminated ',' lines terminated '\n' ignore 1 lines" -u [username] --password= [password] [databasename] echo "done: '"$f"' @ $(date)" done
Comments
Post a Comment