An elegant, colorful, and interactive CLI tool to declutter and organize your Downloads folder.
Project description
๐๏ธ Cabinet CLI
A beautiful, lightning-fast, and interactive command-line interface (CLI) tool written in Python to automatically organize and declutter your Downloads directory.
๐จ Visual Overview
Here is how Cabinet processes and organizes your unstructured files:
๐ฅ The Problem: Messy Downloads Folder
~/Downloads/
โโโ ๐ invoice_may_2026.pdf
โโโ ๐ vacation_photo.heic
โโโ ๐ main.py
โโโ ๐ script.sh
โโโ ๐ backup.tar.gz
โโโ ๐ temporary_file.crdownload <-- (Active download, ignored!)
โโโ ๐ draft_logo.psd
โ๏ธ Processing Pipeline
graph TD
A["Scan downloads folder"] --> B{"Filter active downloads?"}
B -- "Yes: suffix is .crdownload/.part/.tmp" --> C["Ignore file"]
B -- "No" --> D{"Matches Custom Smart Rule?"}
D -- "Yes: keyword match" --> E["Route to custom target folder"]
D -- "No" --> F{"Apply Selected Strategy"}
F -- "Category" --> G["Route by File Type"]
F -- "Date" --> H["Route by YYYY-MM"]
F -- "Extension" --> I["Route by EXT folder"]
F -- "Hybrid" --> J["Route by Category/YYYY-MM"]
E --> K{"Check Destination Conflict"}
G --> K
H --> K
I --> K
J --> K
K -- "File already exists" --> L["Auto-Rename: name (1).ext"]
K -- "Available" --> M["Add to Tree Preview"]
M --> N["Show Preview Tree to User"]
N -- "Confirm: Yes" --> O["Perform physical move & Log to History"]
N -- "Confirm: No" --> P["Cancel operation"]
๐ค The Result: Structured Organization
~/Downloads/
โโโ ๐ Images/
โ โโโ ๐ vacation_photo.heic
โโโ ๐ Documents/
โ โโโ ๐ Factures/ <-- (Custom Smart Rule output!)
โ โ โโโ ๐ invoice_may_2026.pdf
โ โโโ ๐ cv.pdf
โโโ ๐ Code/
โ โโโ ๐ main.py
โ โโโ ๐ script.sh
โโโ ๐ Archives/
โ โโโ ๐ backup.tar.gz
โโโ ๐ Design/
โโโ ๐ draft_logo.psd
โจ Features
- โก 1-Click Sorting: Instant organization of files left at the root of your downloads.
- ๐๏ธ Tree Preview: Shows a beautiful terminal directory tree (
rich.tree) mapping where files will go before moving them. - ๐ก๏ธ Safety First:
- Undo/Revert: One-click rollback restores files to their original location.
- Conflict Resolution: Auto-renames files with naming collisions (e.g.
file (1).pdf) instead of overwriting. - Filter Active Downloads: Safely ignores temporary browser download files (
.crdownload,.part,.tmp,.download).
- ๐ 4 Sorting Strategies:
- Category: Images, Documents, Code, Archives, Videos, Audio, Design, Applications, and Misc.
- Date: Groups files into
YYYY-MM/folders. - Extension: Groups files into
PNG/,PDF/,ZIP/, etc. - Hybrid: Groups by Category first, then by
YYYY-MM/sub-folders.
- โ๏ธ Custom Smart Rules: Define patterns in
rules.json(e.g., match"facture"and direct it toDocuments/Factures/) which take absolute priority. - ๐ Disk Usage Stats: Colorful terminal bar graphs showing you exactly how much disk space is consumed by each file category.
๐ Quick Start & Installation
Option 1: Global Installation with Pipx (Recommended)
Install Cabinet globally in an isolated environment so it doesn't conflict with system packages:
pipx install .
Ensure your local bin path is on your environment path (if not, run pipx ensurepath).
Now, launch the cabinet interface from anywhere:
cabinet
Option 2: Isolated Virtual Environment
If you prefer installing dependencies locally:
- Create and activate virtual environment:
python3 -m venv .venv source .venv/bin/activate
- Install dependencies and package:
pip install .
- Run:
cabinet
๐ Usage Guide
When you run cabinet, you will be greeted by an interactive menu:
Menu Principal :
1. Classer par Catรฉgorie (ex: Images, Documents, Code...)
2. Classer par Date (ex: Annรฉe-Mois/)
3. Classer par Extension (ex: PNG/, PDF/, ZIP/)
4. Classer en mode Hybride (ex: Images/Annรฉe-Mois/)
5. Annuler le dernier rangement (Undo)
6. Trouver et supprimer les doublons
7. Nettoyer/Archiver les vieux fichiers
8. Gรฉrer les rรจgles personnalisรฉes (Smart Rules)
9. Statistiques de l'espace disque (Graphique)
10. Quitter
โช Reverting a Run (Undo)
Made a mistake? Select Option 5 (Undo). The system reads the session cache file (~/.cabinet_history.json), moves the files back, and deletes any empty folders created.
๐ Finding & Cleaning Duplicates
Select Option 6. Cabinet compares SHA-256 signatures of all files. It keeps the first copy and moves duplicates to the macOS native Trash bin (~/.Trash), allowing you to inspect them before emptying.
๐งน Archive Old Files
Select Option 7. Enter file age threshold (e.g., 30 days). Choose to either compress them into a unified .zip archive or directly move them to the macOS Trash bin.
โ๏ธ Managing Smart Rules
Select Option 8. You can add rules dynamically from the command line. Rules are saved in JSON format under ~/.config/cabinet/rules.json.
๐ง File Categorization Map
The default rules mapped in cabinet/config.py cover:
- Images:
.jpg,.jpeg,.png,.gif,.bmp,.svg,.webp,.heic,.tiff,.raw,.psd - Documents:
.pdf,.docx,.doc,.xlsx,.xls,.pptx,.ppt,.odt,.rtf,.txt,.csv,.md,.pages,.numbers,.key - Code:
.py,.js,.ts,.tsx,.jsx,.html,.css,.json,.xml,.yaml,.yml,.sh,.bash,.sql,.rs,.go,.c,.cpp,.h,.java,.kt,.swift,.php,.rb - Audio:
.mp3,.wav,.aac,.flac,.ogg,.m4a,.wma - Video:
.mp4,.mkv,.mov,.avi,.webm,.flv,.mpeg,.mpg - Archives:
.zip,.tar.gz,.tar,.rar,.7z,.dmg,.pkg,.iso,.gz - Design:
.ai,.fig,.sketch,.xd,.indd - Applications:
.app,.exe,.msi
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cabinet_cli-1.0.0.tar.gz.
File metadata
- Download URL: cabinet_cli-1.0.0.tar.gz
- Upload date:
- Size: 28.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6564c7fdb6aee7fff0cc6720564f950daadf4cb2c3434fb9a3b687699433f291
|
|
| MD5 |
f410b4a22b6108fa329d0ab8a5778d91
|
|
| BLAKE2b-256 |
48703ee16b133a8591789a5e243cdafdb13481641f44afa02e4ba6241bc24d19
|
File details
Details for the file cabinet_cli-1.0.0-py3-none-any.whl.
File metadata
- Download URL: cabinet_cli-1.0.0-py3-none-any.whl
- Upload date:
- Size: 24.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e0f3bbb933ee73ddb48d92d155f050192f099de137f3aa4e60fd6c8374e9b3d
|
|
| MD5 |
2f48776f6b6e5df24b591a205540fbf6
|
|
| BLAKE2b-256 |
dce7aebc4c5ddd245a3f90a425ea504513aa9324aee5ed3ef9e268db85bcd395
|