Suraj Suresh
ToolingMar 2026Solo buildPublished Mar 25, 2026

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
Illustration of a terminal window running sortwise, moving files from a cluttered Downloads folder into Documents, Images, and Applications folders.

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

  1. Strategy pattern. Each organization method is its own strategy, so adding a new one does not touch the core engine.
  2. Dry run first. Every run can be previewed before anything moves, because the tool must never lose a file.
  3. Undo as a shell script. A plain bash script is portable and does not require sortwise to reverse a run.
  4. No external dependencies. Standard library only, so there is nothing to install beyond Python.

Tests cover the organizer, the strategies, and the file helpers.