Skip to content

Instantly share code, notes, and snippets.

@woctezuma
Last active June 20, 2021 07:44
Show Gist options
  • Save woctezuma/f4faef1210e49ed06cf4725bac60998f to your computer and use it in GitHub Desktop.
Save woctezuma/f4faef1210e49ed06cf4725bac60998f to your computer and use it in GitHub Desktop.
Fix Roguebook
# References:
# - https://gist.github.com/woctezuma/f4faef1210e49ed06cf4725bac60998f
# - https://steamcommunity.com/app/1076200/discussions/0/3070873501572457641/
from collections import Counter
from pathlib import Path
import glob
import os
game_path = "C:/Applis/Steam/steamapps/common/Roguebook/"
card_path = "Roguebook_Data/StreamingAssets/GameBoxResources/cards_scripts/"
file_path = game_path + card_path
print(file_path)
files = glob.glob(file_path + '*.xlb')
ids = [Path(fname).name.split('.')[0] for fname in files]
c = Counter(ids)
duplicates = [id for id in c if c[id]>1]
for id in duplicates:
files = glob.glob(file_path + id + '*.xlb')
files.sort(key=os.path.getmtime)
for fname in files[:-1]:
print(fname)
Path(fname).rename(fname + '.old')
@woctezuma
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment