From fa426e454e73b3b2c59f416afd0e87a6f84a366e Mon Sep 17 00:00:00 2001 From: halgari Date: Wed, 4 Dec 2024 11:08:19 -0700 Subject: [PATCH] add rename_folders.py --- scripts/rename_folders.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 scripts/rename_folders.py diff --git a/scripts/rename_folders.py b/scripts/rename_folders.py new file mode 100644 index 00000000..b49c3e00 --- /dev/null +++ b/scripts/rename_folders.py @@ -0,0 +1,16 @@ +import json +import os +import shutil + +# Load game name to ID mapping +with open('json/ids.json', 'r') as f: + game_mappings = json.load(f) + +# Iterate over the directories inside 'json' folder +base_path = 'json' +for game_name in os.listdir(base_path): + full_path = os.path.join(base_path, game_name) + if os.path.isdir(full_path) and game_name in game_mappings: + game_id = game_mappings[game_name] + new_full_path = os.path.join(base_path, game_id) + shutil.move(full_path, new_full_path) \ No newline at end of file