递归所有目录下的文件
import os
def get_all_file(dir_path):
file_list = []
files = os.listdir(dir_path)
for file in files:
current_path = os.path.join(dir_path, file)
if os.path.isdir(current_path):
inner_file_path = get_all_file(current_path)
file_list.extend(inner_file_path)
else:
file_list.append(current_path)
return file_list