import glob,sys,subprocess,time,os,ROOT pandapath=os.environ.get('PANDAPATH') home=os.environ.get('HOME') sys.path.append(pandapath+'/macro/tpc/FOPI/python/argparse-1.2.1') import argparse, commands parser=argparse.ArgumentParser(description='check if batchfiles were fiished correctly') parser.add_argument('--path',help='path to batch output folder',type=str,default=home+"/sgeout/") parser.add_argument('--dev',help='delete files which have n events',type=int,default=[-1],nargs='+') parser.add_argument('--dme',help='delete files which are mergers',action='store_true') parser.add_argument('--complete',help='delete completed files',action='store_true') parser.add_argument('--delolder',help='delete files older than (JJJJ-MM-DD-HH-mm)',type=str,default='') parser.add_argument('--resubmit',help='resubmit jobs which failed',action='store_true') parser.add_argument('--resubmitAll',help='resubmit jobs which are sill in path',action='store_true') parser.add_argument('--resubExclude',help='exclude files with this pattern in filename from resubmitting',type=str,default='aPatternHopefullyNotInTheFileName') parser.add_argument('--delResub',help='delete output files which were resubmitted',action='store_true') args=parser.parse_args() #print args.path #os.system('ls '+args.path) runtimes=open('batch_runtimes.txt','a') ndefect=0 for dirpath,dirnames,filenames in os.walk(args.path): #filenames.sort() totev=-1 for filename in filenames: # infile=open(dirpath+filename,'r') good=False delete=False if args.delolder!='': ctime=time.localtime(os.path.getctime(dirpath+filename)) oldtime=time.strptime(args.delolder,'%Y-%m-%d-%H-%M') if ctime