Skip to main content

🗄️ Cabinet CLI

OS Python License

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:
    1. Category: Images, Documents, Code, Archives, Videos, Audio, Design, Applications, and Misc.
    2. Date: Groups files into YYYY-MM/ folders.
    3. Extension: Groups files into PNG/, PDF/, ZIP/, etc.
    4. 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 to Documents/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

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:

  1. Create and activate virtual environment:
    python3 -m venv .venv
    source .venv/bin/activate
    
  2. Install dependencies and package:
    pip install .
    
  3. 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

Metadata

Release files for cabinet-cli 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cabinet-cli 1.0.0
File Size Uploaded Provenance Actions
cabinet_cli-1.0.0.tar.gz 28.0 kB Without provenance Details for cabinet_cli-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cabinet-cli 1.0.0
File Interpreter ABI Platform Actions
cabinet_cli-1.0.0-py3-none-any.whl Python 3 none any Details for cabinet_cli-1.0.0-py3-none-any.whl

Total release size: 52.2 kB

Release files / cabinet_cli-1.0.0.tar.gz

Download URL cabinet_cli-1.0.0.tar.gz
Size 28.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6564c7fdb6aee7fff0cc6720564f950daadf4cb2c3434fb9a3b687699433f291
BLAKE2b-256 checksum
How to use checksums
48703ee16b133a8591789a5e243cdafdb13481641f44afa02e4ba6241bc24d19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / cabinet_cli-1.0.0-py3-none-any.whl

Download URL cabinet_cli-1.0.0-py3-none-any.whl
Size 24.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7e0f3bbb933ee73ddb48d92d155f050192f099de137f3aa4e60fd6c8374e9b3d
BLAKE2b-256 checksum
How to use checksums
dce7aebc4c5ddd245a3f90a425ea504513aa9324aee5ed3ef9e268db85bcd395
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for cabinet-cli 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page