单反吧 关注:2,094,056贴子:23,862,024
  • 3回复贴,共1

怎么能快速选出一堆jpg图片的同名raw文件???

取消只看楼主收藏回复

同时保存了jpg和raw。。jpg选完片之后,怎么能快速筛选出同名字的raw文件,一个个选太麻烦了。有什么快速办法没?


IP属地:福建1楼2023-06-03 23:05回复
    参考33楼代码。 把选出的jpg和所有raw文件 放同一个文件夹下, 代码程序也放同个文件夹,运行。直接选出所有和jpg同名的raw。 简单快捷, 代码需要根据你的raw文件不同的后缀修改、


    IP属地:福建47楼2023-06-06 21:47
    回复
      2025-06-29 16:07:24
      广告
      参考33楼代码。 把选出的jpg和所有raw文件 放同一个文件夹下, 代码程序也放同个文件夹,运行。直接选出所有和jpg同名的raw。 简单快捷, 代码需要根据你的raw文件不同的后缀修改、


      IP属地:福建来自Android客户端53楼2025-01-31 22:03
      回复
        import os
        import shutil
        def copy_matching_arw_files():
        # 获取当前工作目录
        current_dir = os.getcwd()
        # 收集所有JPG文件的基本文件名(不区分大小写)
        jpg_basenames = set()
        for filename in os.listdir(current_dir):
        if os.path.splitext(filename)[1].lower() == '.jpg':
        jpg_basenames.add(os.path.splitext(filename)[0])
        # 收集匹配的ARW文件
        arw_files = []
        for filename in os.listdir(current_dir):
        if os.path.splitext(filename)[1].lower() == '.arw':
        basename = os.path.splitext(filename)[0]
        if basename in jpg_basenames:
        arw_files.append(filename)
        if not arw_files:
        print("未找到匹配的ARW文件")
        return
        # 创建目标文件夹
        target_dir = os.path.join(current_dir, "ARW_Files")
        os.makedirs(target_dir, exist_ok=True)
        # 复制文件
        for arw_file in arw_files:
        src = os.path.join(current_dir, arw_file)
        dst = os.path.join(target_dir, arw_file)
        shutil.copy2(src, dst)
        print(f"已复制: {arw_file}")
        print(f"\n成功复制 {len(arw_files)} 个ARW文件到目录: {target_dir}")
        if __name__ == "__main__":
        copy_matching_arw_files()


        IP属地:福建54楼2025-02-06 20:15
        收起回复