Hi!
I'm sorry for "hijacking" a thread (I sincerely hope it won't be understood as hijacking, by no means I want to do any harm). Your solution didn't work for me (I use Linux and play EHM in Wine, although your bat scripts didn't work for me - maybe it was my mistake, I didn't really try and find out why).
Once again, I don't mean do to any harm, I'm just trying to help people who don't want to or can't use McQwak's solution for any reason. If anyone consider my post offensive, I'm willing to delete it.
Thus, I wrote my own solution, it's the following python script:
Code: Select all
import argparse
import os
import re
def adjust_files(dir, years, should_print):
filename_re = re.compile("(.*_.*_(\d|\d\d)_(\d|\d\d)_)(\d\d\d\d).png")
os.chdir(dir)
for filename in os.listdir("."):
matches = filename_re.match(filename)
if matches:
old_year = int(matches.group(4))
new_year = str(old_year + years)
new_name = matches.group(1) + new_year + ".png"
os.rename(filename, new_name)
if should_print:
print("Renaming %s to %s" % (filename, new_name))
else:
print(filename + " doesn't match.")
if __name__ == "__main__":
ap = argparse.ArgumentParser()
ap.add_argument("-d",
"--directory",
help="Directory with the face pack",
default=os.getcwd())
ap.add_argument("-v",
"--verbose",
help="Print what is being done",
action="store_true")
ap.add_argument("-y",
"--years",
help="How many years should be added (works for negative)",
type=int,
default=0)
args = ap.parse_args()
adjust_files(args.directory, args.years, args.verbose)
IMPORTANT! Use only if you understand how to use it and use it at your own risk only! I tested it and it worked but I don't guarantee it will work for every case you might try, so always make a backup of your data.
Maybe I will try and make it more user friendly later but now I'm quite busy.