#!/usr/bin/python import os import glob for i in glob.glob('/mnt/datafolder/objects/objects-1/*'): file = i command1 = 'db2 connect to mydb1 user db2inst1 using ics421' command2 = 'db2 load from ' + file + ' of del insert into Object' print "Executing: " + command1 os.system(command1) print "Executing: " + command2 os.system(command2)