plugins_base_func.py 754 B

1234567891011121314151617181920212223
  1. import os
  2. # 输入文件夹,并检查是否是一个正常的图片文件夹。
  3. def check_goods_folder(folder_path):
  4. all_files = os.listdir(folder_path)
  5. for file in all_files:
  6. file_path = "{}/{}".format(folder_path, file)
  7. if not os.path.isdir(file_path):
  8. continue
  9. if "原始图" in os.listdir(file_path):
  10. return folder_path
  11. # 上述检查不通过,可能是选择目录错误
  12. if "原始图" in all_files:
  13. root_path, _ = os.path.split(folder_path)
  14. return root_path
  15. return None
  16. if __name__ == '__main__':
  17. a = check_goods_folder(
  18. r"D:\MyDocuments\PythonCode\MyPython\red_dragonfly\deal_pics\auto_capture_V2\auto_photo\output\2024-12-20-2")
  19. print(a)