Home > database >  How the load data infile batch import multiple TXT file
How the load data infile batch import multiple TXT file

Time:10-01

Everybody is good, the problem description:
1, be faced with hundreds of TXT file need to import, each file has its own name, name and update every day, need to write a lot of the load data statement workload
My idea is that
The load data local infile 'C:/Users/luozhanyue/Desktop/rpt_', '20171205', '/data - the WFD - PY - all - "& amp; Sat_data & amp;" .txt 'replace into table repayments fields terminated by', ';

Become
Set the address variable
The set @ addr=concat (' C:/Users/luozhanyue/Desktop/rpt_ ', '20171205', '/DATA - WFD - PY - all - "& amp; Sat_data & amp;" .txt ');
Address variable in a function
The load data local infile @ adrr replace into table repayments fields terminated by ', ';
Found it feasible to

Do you have any other good way to bulk import multiple TXT files, I now hand can get TXT file name list every day,

CodePudding user response:

Bat or powershell script can do

CodePudding user response:

Write a loop under Linux folder all the files of the
Similar
For I ` in ls `; Do the echo $I; The done
Windows should also have a script
  • Related