import os
def get_all_folders(directory):
"""
递归地获取指定目录下的所有文件夹名称(包括子文件夹中的文件夹)
"""
full_path = []
for root, dirs, files in os.walk(directory):
for file in files:
if file.endswith('Z.npy'):
# 构造并打印文件的完整路径
full_path_temp = os.path.join(root, file)
# print(f"Found Z.npy file: {full_path_temp}")
full_path.append(full_path_temp)
return full_path
获取指定文件夹下所有的文件路径
于 2024-09-04 15:02:09 首次发布