• You've discovered RedGuides 📕 an EverQuest multi-boxing community 🛡️🧙🗡️. We want you to play several EQ characters at once, come join us and say hello! 👋
  • IS THIS SITE UGLY? Change the look. To dismiss this notice, click the X --->
  • There is a suspension/ban wave happening, we're still gathering information. Please keep regular discussion to Suspension MegaThread and please consider submitting a Suspension report to RG.
Resource icon

Utility Python scripts to backup Character INI files

Here are some python utilities that will allow you to copy your toon.ini files for a specific server to another directory (for backup, update of EverQuest, etc). I found this really helpful when managing a large amount of toons. Helpful with just a 6 box as well to maintain backups. The code will read your target directory and grab all .ini files containing your passed in server. For example Gimpsauce_povar.ini(Live) or BotBoi__EZ (Linux) x4 Exp.ini (emu EZ)


To use:

1. Setup Python. Lots of info available on python setup.
2. Store these files in the same directory. Save the Utilities class as equtil.py. The copy script imports this class and will not work if named differently.
3. Test it: I'd setup a test folder and test this out for your own peace of mind. I tested with both Windows and Linux.
4. Run it:
Linux (Bash on Ubuntu for Windows): python CopyServerCharFiles.py -d /mnt/d/EverQuest -t /mnt/d/IniBackup -s povar

Windows: python CopyServerCharFiles.py -d D:\EverQuest -t D:\IniBackup -s povar


equtil.py - Utilities class.
Rich (BB code):
import os
import os.path
import sys
import re
import shutil
from optparse import OptionParser


class EQUtilities:
   

"""Get all filepaths in a directory"""
def getFilePaths(self, baseFolder):
     file_paths = []  
     for root, directories, files in os.walk(baseFolder):
         for filename in files:        
             filepath = os.path.join(root, filename)
             file_paths.append(filepath)
         #for x in file_paths:
             #print(x) 
     return file_paths

"""Copy file from source to target directory"""
def copyFiles(self, fromfile, tofile):
     if os.path.exists(fromfile):
            shutil.copyfile(fromfile, tofile)
     else:
        print(fromfile + " does not exist")

"""Method to update ini files based on server"""
def copycharconfigs(self, olddir, newdir, server):
   
    print(olddir)
    print(newdir)
    basefile = "_" + server + ".ini"
       
    eqfiles = self.getFilePaths(olddir)

    print(len(eqfiles))

    for x in eqfiles:
        if basefile in x:
            print(x)
            print(os.path.basename(x))
            filename = os.path.basename(x)
         
            tofile = os.path.join(newdir, filename)
            self.copyFiles(x, tofile)

def test(self):
    print("Works")


CopyServerCharFiles.py

Rich (BB code):
import os
import os.path
import sys
import re
import subprocess
from optparse import OptionParser
from equtil import EQUtilities


eq = EQUtilities()


"""Script that copies character ini files"""
if __name__=="__main__":

    parser = OptionParser()   
parser.add_option('-d','--directory',help='full path of from directory',default=None)
parser.add_option('-t','--target',help='full path of to directory',default=None)
parser.add_option('-s','--server',help='toon server such as povar or _EZ (Linux) x4 Exp',default=None)
(args,args_extra) = parser.parse_args()

print("Copying INI Files")

print("Copying from: " + args.directory)
print("Copying to " + args.target)
print("Server to use " + args.server)

#eq.test()

###  Usage   pyhon CopyServerCharFiles -d <EverQuest Directory> -t <Target Backup Directory>  -s <Server such as povar or _EZ (Linux) x4 Exp>

eq.copycharconfigs(args.directory, args.target, args.server)


Hope this helps.
Author
jackstraw01
First release
Last update
Rating
0.00 star(s) 0 ratings

Share this resource

Back
Top