Skip to content

Instantly share code, notes, and snippets.

@silveira
Created July 28, 2019 19:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save silveira/b67ed05d73bb3289dce69f188fe58c8a to your computer and use it in GitHub Desktop.
Save silveira/b67ed05d73bb3289dce69f188fe58c8a to your computer and use it in GitHub Desktop.
Renaming a bunch of sailor moon episodes so PLEX can understand them
import glob, os
os.chdir("E:\Anime\Seriados\Sailor Moon")
offset = 46
for file in glob.glob("*.mkv"):
if (file.find("Sailor_Moon_R")!=-1):
pieces = file.split("_")
old_number = int(pieces[6])
new_number = old_number + offset
pieces[6] = str(new_number)
new_name = "_".join(pieces)
print(file, new_name)
os.rename(file, new_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment