This folder contains two Python scripts that automatically organize your TV show files into clean folders, ready for your media library.
/DIRECTORY
├── organizeFlixtor.py
├── organizeFormated.py
├── INSTRUCTIONS.md
├── Alice.in.Borderland.2020.S01E01.Pilot.mkv
├── Alice.in.Borderland.2020.S01E02.Next.Game.mkv
├── Alice in Borderland (2020) S02E01 Pilot.mkv
└── Alice in Borderland (2020) S02E02 1988.mkvThis script organizes raw, unformatted Flixtor-style (https://Flixtor.to) files (which often contain dots . instead of spaces) into properly named series folders and season subfolders.
It also renames the episodes into a readable format.
The script detects files using this structure: Title.year.SxxEyy.EpisodeTitle.extension
Examples:
Alice.in.Borderland.2020.S01E01.Pilot.mkvBreaking.Bad.2008.S02E03.Bit.by.a.Dead.Bee.mp4The.Last.of.Us.2023.S01E09.Look.for.the.Light.mkv
- The script scans all files in the same folder where it’s placed.
- It uses a regular expression to detect
SxxEyypatterns. - It automatically creates:
- a series folder:
Title (year) - a season subfolder:
Season xx
- a series folder:
- It renames and moves each episode into its correct location.
Before:
/DIRECTORY
├── organizeFlixtor.py
├── Alice.in.Borderland.2020.S01E01.Pilot.mkv
├── Alice.in.Borderland.2020.S01E02.Next.Game.mkv
├── Alice.in.Borderland.2020.S02E01.Return.mkv
└── Alice.in.Borderland.2020.S02E02.Goodbye.mkvAfter:
/DIRECTORY
├── organizeFlixtor.py
└── Alice in Borderland (2020)
├── Season 01
│ ├── Alice in Borderland (2020) S01E01 Pilot.mkv
│ └── Alice in Borderland (2020) S01E02 Next Game.mkv
└── Season 02
├── Alice in Borderland (2020) S02E01 Return.mkv
└── Alice in Borderland (2020) S02E02 Goodbye.mkvpython3 organizeFlixtor.pyThe script will display a message for each episode it moves and renames.
This script organizes already properly named files (e.g. Title (year) SxxEyy EpTitle) into their correct season folders without renaming them.
The script detects files with the following format:
Title (year) SxxEyy EpisodeTitle.extension
Examples:
Alice in Borderland (2020) S01E01 Pilot.mkvAlice in Borderland (2020) S02E02 1988.mkvBreaking Bad (2008) S01E03 ...And the Bag's in the River.mp4
- The script identifies the series title, year, and season number from the filename.
- It automatically creates:
- a series folder:
Title (year) - a season subfolder:
Season xx
- a series folder:
- It moves the file into the correct folder without changing its name.
Before:
/DIRECTORY
│
├── organizeFormated.py
├── Alice in Borderland (2020) S01E01 Pilot.mkv
├── Alice in Borderland (2020) S01E02 Next Game.mkv
├── Alice in Borderland (2020) S02E01 Return.mkv
└── Alice in Borderland (2020) S02E02 Goodbye.mkvAfter:
/DIRECTORY
│
├── organizeFormated.py
│
└── Alice in Borderland (2020)
├── Season 01
│ ├── Alice in Borderland (2020) S01E01 Pilot.mkv
│ └── Alice in Borderland (2020) S01E02 Next Game.mkv
└── Season 02
├── Alice in Borderland (2020) S02E01 Return.mkv
└── Alice in Borderland (2020) S02E02 Goodbye.mkvpython3 organizeFormated.pyEach file will be moved into its respective season folder.
- Both scripts automatically ignore the following files:
organizeFlixtor.pyorganizeFormated.pyINSTRUCTIONS.md
- Files that don’t match the required pattern will be skipped and shown as “ignored”.
- No files are deleted — only moved into folders.
You can safely use both scripts in the same folder:
-
Run
organizeFlixtor.pyfirst to clean up messy Flixtor-style names. -
Then run
organizeFormated.pyto finish sorting already formatted files.
python3 organizeFlixtor.py
python3 organizeFormated.py/DIRECTORY
├── organizeFlixtor.py
├── organizeFormated.py
├── INSTRUCTIONS.md
└── Alice in Borderland (2020)
├── Season 01
│ ├── Alice in Borderland (2020) S01E01 Pilot.mkv
│ └── Alice in Borderland (2020) S01E02 Next Game.mkv
└── Season 02
├── Alice in Borderland (2020) S02E01 Return.mkv
└── Alice in Borderland (2020) S02E02 Goodbye.mkvThanks to ChatGPT for this script.