#!/usr/bin/env python3 import os import glob model_dir = "/home/yanghao05/Workspace/gochat/internal/model" channel_dir = "/home/yanghao05/Workspace/gochat/internal/model/channel" for pattern_dir in [model_dir, channel_dir]: for f in glob.glob(os.path.join(pattern_dir, "*.go.txt")): newname = f[:-4] # remove .txt suffix print(f"Renaming: {f} -> {newname}") os.rename(f, newname) # Cleanup for cleanup in [ os.path.join(model_dir, "test_write.go"), os.path.join(model_dir, "base_test.txt"), "/home/yanghao05/Workspace/gochat/rename_models.sh.txt", ]: if os.path.exists(cleanup): print(f"Removing: {cleanup}") os.remove(cleanup) print("Done!")