def clean_filenames(): # Get all files in the current directory files = os.listdir('.') print(f"Scanning for episodes in: os.getcwd()") for filename in files: # Skip the script itself if filename == "rename_episodes.py": continue # Look for patterns like S01E05, s01e05, 1x05, 105, etc. match = re.search(r'[sS]0?1[eE](\d2)|1x(\d2)', filename) if match: # Extract the episode number ep_num = match.group(1) or match.group(2) # Construct the new name (Standard Plex/Jellyfin format) new_name = f"SHOW_NAME - SSEASON_NUMEep_numos.path.splitext(filename)[1]" print(f"Renaming: filename -> new_name") os.rename(filename, new_name) else: print(f"Skipped (No pattern found): filename") Barbarians Web Series Download In Hindi - You May Find
# Set your show details here SHOW_NAME = "Prison Break" SEASON_NUM = "01" W10 11langpack.ps1 Info
A script or tool that automatically detects the episode numbers buried in the filenames and renames them into a clean, uniform structure for your media server (like Plex, Jellyfin, or Kodi).
When downloading TV shows with format strings like prison break complete season 1 720p dual audio , the files inside often have inconsistent names (e.g., prison.break.s01e01.720p.mkv , PB_101.mkv , etc.).