import os

# 设置你的目标文件夹路径
folder_path = r'G:\python_ws_g\data\test\tiff_json'  # 例如 r'G:\data\LaserData'

# 遍历该文件夹下的所有文件
for filename in os.listdir(folder_path):
    if filename.endswith('_color.json'):
        # 构造旧文件路径和新文件路径
        old_path = os.path.join(folder_path, filename)
        new_filename = filename.replace('_color.json', '_rgbd.json')
        new_path = os.path.join(folder_path, new_filename)

        # 重命名文件
        os.rename(old_path, new_path)
        print(f'Renamed: {filename} -> {new_filename}')
