A smart file grouping tool that automatically organizes files into folders based on their filename prefixes. Perfect for sorting TV series episodes, numbered documents, or any files with consistent naming patterns.
π₯ Download Standalone Executable (Windows):
Download the latest ready-to-run binary from GitHub Releases (prefix-file-sort-windows.zip). No Python installation required!
- π Smart Prefix Detection: Automatically extracts and groups files by their filename prefix (text before the first
-) - ποΈ Real-time Preview: Preview grouping results before executing any file operations
- β©οΈ Safe Undo: Instantly undo the last batch of file moves with one click
- β‘ Multi-threaded: Responsive UI that won't freeze during large batch operations
- π― Flexible Filtering: Filter files by extension (e.g.,
.mp4,.jpg, .png) - π Multiple Sort Modes: Order groups by name, natural order, modification time, or file size
- π Conflict Handling: Choose how to handle naming conflicts (Skip, Overwrite, Auto-Rename)
- π Drag & Drop: Drag folders directly into the application (when tkinterdnd2 is installed)
- π¨ Themes & Languages: Built-in light/dark themes and English / δΈζ interface
- π Activity Log: Track all file operations with detailed logging
- Python 3.8 or higher
- tkinter (usually included with Python)
- Clone the repository:
git clone https://github.com/keyenhuang/prefix-file-sort.git
cd prefix-file-sort- Install dependencies (optional, for drag & drop support):
pip install -r requirements.txt- Run the application:
python main.py- Click Browse to select a folder containing your files
- Set the Default Suffix for created folders (e.g.,
series,episode) - Optionally, set a File Filter to only process specific file types
- Click Preview Groups to see how files will be organized
- Click Execute Move to perform the actual file grouping
Given files in a folder:
01-S01E01.mkv
01-S01E02.mkv
02-S02E01.mkv
02-S02E02.mkv
03-S03E01.mkv
After running with suffix - episodes:
βββ 01 - episodes/
β βββ 01-S01E01.mkv
β βββ 01-S01E02.mkv
βββ 02 - episodes/
β βββ 02-S02E01.mkv
β βββ 02-S02E02.mkv
βββ 03 - episodes/
βββ 03-S03E01.mkv
Enable Numbered Custom Mode and provide custom names:
01 - First Season
02 - Second Season
03 - Third Season
The app will use these names instead of the default naming pattern.
| Policy | Behavior |
|---|---|
| Skip | Skip files that would cause conflicts (default) |
| Overwrite | Replace existing files with the same name |
| Auto-Rename | Rename new files to avoid conflicts (e.g., file (1).txt) |
Choose how groups are ordered via the Sort by dropdown (in Robustness Settings):
| Mode | Behavior |
|---|---|
| Name (A-Z) | Alphabetical by prefix (default) |
| Natural order | Numeric-aware ordering: 2 before 10 |
| Newest first / Oldest first | By the newest/oldest file's modification time in each group |
| Largest first / Smallest first | By total file size of each group |
Separate multiple extensions with commas:
.mp4- Only process MP4 files.jpg, .png, .gif- Process image files- Leave empty - Process all files
Enable Prefix Case Sensitive to treat Episode and episode as different prefixes.
# Install dependencies
pip install -r requirements.txt
# Run the application
python main.py# Run the test suite (headless, no GUI required)
python run_tests.py
# Lint with ruff
pip install ruff
ruff check .prefix-file-sort/
βββ main.py # GUI application (tkinter) β entry point
βββ core.py # Core grouping/move/undo logic (tkinter-free, unit-tested)
βββ i18n.py # Internationalization (English / δΈζ)
βββ themes.py # Light / dark theme manager
βββ tests/ # Unit & integration tests
βββ run_tests.py # Test runner
βββ prefix_file_sort.spec # PyInstaller spec for building a Windows .exe
βββ build.bat # Windows build helper
βββ requirements.txt # Python dependencies
βββ pyproject.toml # Project metadata & ruff lint config
βββ .github/ # CI workflows & issue/PR templates
βββ README.md # This file
βββ LICENSE # MIT License
βββ CONTRIBUTING.md # Contribution guidelines
βββ CODE_OF_CONDUCT.md # Community code of conduct
βββ SECURITY.md # Vulnerability reporting policy
βββ CHANGELOG.md # Version history
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please read our Contributing Guide for details on how to submit pull requests. By participating, you agree to abide by the Code of Conduct.
Found a vulnerability? Please see SECURITY.md for private reporting instructions β do not open a public issue.
See CHANGELOG.md for version history.
Keyen Huang
- GitHub: @keyenhuang
- Built with Python's tkinter library
- Drag & drop support via tkinterdnd2
