1 2 3 4 5 6 7 8 9 10 11
def get_all_files(dir): result = [] for name in os.listdir(dir): path = os.path.join(dir, name) if os.path.isfile(path): result.append(path) else: tmp_result = get_all_files(path) result += tmp_result return result