A Python-powered CLI tool to automatically organize files inside any target folder.
Built with clean architecture principles for flexibility, scalability, and ease of maintenance.
This project automates file organization by scanning a specified folder and sorting files into subfolders based on file types.
It is designed for one-click execution — run it once to declutter, run it again anytime to maintain order.
os
module — for file and folder operationsshutil
— for safe copying and moving of filespathlib
— for robust path handling (cross-platform)
No external packages required — pure Python.
-
Load Config:
Reads settings from aconfig.json
file (path and sorting rules). -
Scan Folder:
Lists all files in the target directory. -
Process Files:
For each file:- Detect file type
- Decide target subfolder
- Create subfolder if needed
- Move the file
-
Log Result:
Prints each operation for full transparency. -
Done!
Below is the high-level workflow of the automation logic:
file-automation/ ├── file_manager.py ├── config.example.json # Template config file — copy this to create your own config ├── .gitignore └── README.md
-
Automated Sorting — Classifies and relocates files into structured directories based on configurable rules.
-
Robust Logging — Generates detailed logs for all operations and errors, ensuring traceability.
-
One-Command Execution — Simple, single-run script to maintain folder integrity.
-
Lightweight & Configurable — Pure Python solution with flexible JSON-based settings.