#!/apps/python/PRO/bin/python import sys, getopt, os loc ='localdir/' files = [] RUNS = [] for f in os.listdir(loc): if f.endswith('root'): files.append(f) r = f[8:14] RUNS.append(int(r)) files.sort() RUNS.sort() for R in RUNS: cmd = "root -b -q \"doit.C("+str(R)+")\"" print cmd os.system(cmd)