Skip to main content

An elegant, colorful, and interactive CLI tool to declutter and organize your Downloads folder.

Project description

๐Ÿ—„๏ธ 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

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:

  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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cabinet_cli-1.0.0.tar.gz (28.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cabinet_cli-1.0.0-py3-none-any.whl (24.3 kB view details)

Uploaded Python 3

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

Hashes for cabinet_cli-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6564c7fdb6aee7fff0cc6720564f950daadf4cb2c3434fb9a3b687699433f291
MD5 f410b4a22b6108fa329d0ab8a5778d91
BLAKE2b-256 48703ee16b133a8591789a5e243cdafdb13481641f44afa02e4ba6241bc24d19

See more details on using hashes here.

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

Hashes for cabinet_cli-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7e0f3bbb933ee73ddb48d92d155f050192f099de137f3aa4e60fd6c8374e9b3d
MD5 2f48776f6b6e5df24b591a205540fbf6
BLAKE2b-256 dce7aebc4c5ddd245a3f90a425ea504513aa9324aee5ed3ef9e268db85bcd395

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page