nextcloud-helper/games/wow/wowchardefaults.py

30 lines
No EOL
1,016 B
Python

import os
import sys
import shutil
import time
import
basepath = r"C:\Games_SSD\World of Warcraft\_retail_\WTF\Account"
cdpath = r"C:\Games_SSD\World of Warcraft\_retail_\WTF\Account\Chardefaults"
def copy_defaults(charpath):
for cdfile in os.listdir(cdpath):
cdp_char = os.path.join(charpath, cdfile)
cdp_charbak = os.path.join(charpath, cdfile + ".cdbak")
cdp_src = os.path.join(cdpath, cdfile)
if os.path.exists(cdp_charbak):
continue
if os.path.exists(cdp_char):
shutil.move(cdp_char, cdp_charbak)
shutil.copy2(cdp_src, cdp_char)
for acct in os.listdir(basepath):
if acct[:10].upper() == 'CECILKORIK' and os.path.isdir(os.path.join(basepath,acct)):
for servname in os.listdir(os.path.join(basepath,acct)):
servdir = os.path.join(basepath,acct,servname)
if servname != 'SavedVariables' and os.path.isdir(servdir):
for charname in os.listdir(servdir):
chardir = os.path.join(servdir,charname,"SavedVariables")
if os.path.isdir(chardir):
copy_defaults(chardir)