Skip to content

Instantly share code, notes, and snippets.

@Haaroon
Last active January 14, 2023 12:57
Show Gist options
  • Save Haaroon/32c678e1a11b4cf3b47bd615afef6a68 to your computer and use it in GitHub Desktop.
Save Haaroon/32c678e1a11b4cf3b47bd615afef6a68 to your computer and use it in GitHub Desktop.
rename downloaded one pace files into proper SXXEXX format
import os
def run(season):
files = sorted([file for file in os.listdir('.') if file.startswith("One.Piece")])
for i, file in enumerate(files, 1):
new_name = f"One.Piece.S{season}E{str(i).zfill(2)}.mkv"
print(f"{file} -> {new_name}")
if input("Do You Want To Continue? [y/n]") == "y":
for i, file in enumerate(files, 1):
new_name = f"One.Piece.S{season}E{str(i).zfill(2)}.mkv"
os.rename(file, new_name)
@Haaroon
Copy link
Author

Haaroon commented Jan 14, 2023

Cd into your season folder

Open up a python shell

Paste this into shell

then run

season=01
run(season)

Where you must put the season number

script will show you what it will do, press y and enter and then it will run,

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