import os


# 输入文件夹，并检查是否是一个正常的图片文件夹。
def check_goods_folder(folder_path):
    all_files = os.listdir(folder_path)
    for file in all_files:
        file_path = "{}/{}".format(folder_path, file)
        if not os.path.isdir(file_path):
            continue
        if "原始图" in os.listdir(file_path):
            return folder_path
    # 上述检查不通过，可能是选择目录错误
    if "原始图" in all_files:
        root_path, _ = os.path.split(folder_path)
        return root_path
    return None


if __name__ == '__main__':
    a = check_goods_folder(
        r"D:\MyDocuments\PythonCode\MyPython\red_dragonfly\deal_pics\auto_capture_V2\auto_photo\output\2024-12-20-2")
    print(a)
