1 import os 2 3 def getFiles(rootDir): 4 if os.path.isfile(rootDir): 5 print(rootDir) 6 elif os.path.isdir(rootDir): 7 for x in os.listdir(rootDir): 8 getFiles(os.path.join(rootDir, x)) 9 10 with open('C:\Users\admin\Desktop\FileList.txt', 'r') as f: 11 lines = f.readlines() 12 for line in lines: 13 line = line.strip(' ') 14 getFiles(line)