remove_ntuples.py
Go to the documentation of this file.
1 import sys,os
2 
3 filepath = "/lbne/data/users/ljf26/fluxfiles/g4lbne/v3r0p10/"
4 
5 # Make sure user really wants to do this
6 input_variable = raw_input ("Deleting all ntuples in path "+filepath+"\n\t Are you sure [Y/n]: ")
7 
8 if input_variable != "Y":
9  print "You didn't enter 'Y' -- quitting"
10  sys.exit()
11 
12 # Walk over files, find ntuples, delete them
13 for dirpath, subdirs, files in os.walk(filepath):
14  for file in files:
15  if file.startswith("g4lbne") and file.endswith(".root"):
16  print file
17  os.remove(os.path.join(dirpath,file))
18 
19 print "All done."