1basepath = "pathtodir/DataFiles/"
2for filename in os.listdir(basepath):
3 if filename.endswith(".log"):
4 print(os.path.join("./DataFiles", filename))
5
6 with open(basepath + filename) as openfile:
7 for line in openfile:
8 ........