Skip to content

Productivity

Cleaning the Chaos: Automating File Organization with Python

The "Downloads" folder inevitably turns into a "black hole" where documents, archives, and media blend into an endless list. To avoid wasting time on manual sorting, I developed a simple Python script to handle the heavy lifting.

This exercise allowed me to practice filesystem operations and bring a bit more order to my Linux Mint environment.

Project Sourse

The full implementation is available on GitHub: vvsparrow/file-sorter

Constructive feedback and suggestions are always appreciated as I continue my Python journey.

Linux Downloads folder full of cluttered files before automated
sorting Linux Downloads folder full of cluttered files before automated sorting.

My Technical Workflow

I utilized the pathlib library for a modern approach to path manipulation and shutil for secure file transfers. The script analyzes file extensions and assigns them to predefined categories.

Key Features:

  • Multi-part Extension Support: The script correctly handles files like .tar.gz instead of just looking at the final suffix.
  • Safety First: If a category folder doesn't exist, the script creates it automatically using mkdir(exist_ok=True).