mysql-load-detections.py

#!/usr/bin/python

import os
import glob

os.system('mysql -u mysqlinst1 -pics421 -e \'use mydb1;\'')
for i in glob.glob('/mnt/home/mysqlinst1/detections-1/*'):
    file = i
    useStatement = 'use mydb1;'
    loadStatement = 'load data local infile \'' + file + '\' into table Detection fields terminated by \',\' lines terminated by \'\\n\';'
    command = 'mysql -u mysqlinst1 -pics421 -e "' + useStatement + ' ' + loadStatement + '"'
    print "Executing: " + command
    os.system(command)
Valid HTML 4.01 Valid CSS