sortwise, a directory organizer CLI
Sorts a messy folder by type, date, or your own rules, with a dry-run preview, an undo script for every run, and no dependencies outside the standard library.
My contribution
Solo. I wrote the CLI, the strategy implementations, the config loader, and the tests.
- Python
- CLI
- pytest
Problem
Everyone has a Downloads folder with hundreds of unsorted files. I wanted a single command that sorts it by file type, by date, or by rules I define, without ever losing a file.
What it does
sortwise groups files into folders like Images, Documents, and Videos, or into year and month folders, or into categories from a JSON config. It previews changes with a dry-run flag, writes a rollback script with every operation so any run can be undone without the tool, renames collisions instead of overwriting, and logs every move.
Design decisions
- Strategy pattern. Each organization method is its own strategy, so adding a new one does not touch the core engine.
- Dry run first. Every run can be previewed before anything moves, because the tool must never lose a file.
- Undo as a shell script. A plain bash script is portable and does not require sortwise to reverse a run.
- No external dependencies. Standard library only, so there is nothing to install beyond Python.
Tests cover the organizer, the strategies, and the file helpers.