Unclutter your directory with ease.
Project description
Unclutter Directory 🗂️
A smart file organization tool that automatically sorts your files and directories based on customizable rules.
Features ✨
-
Multi-Action Support
- 🚚 Move files/directories to specific locations
- 🗑️ Delete obsolete items
- 📦 Compress files/directories to ZIP archives
- 🔍 Search inside ZIP/RAR archives for matching files
-
Advanced Matching
- Name patterns (starts/ends with, contains, regex)
- File size thresholds (larger/smaller than)
- Age conditions (older/newer than)
- Directory-specific rules (
is_directoryflag) - Case-sensitive/insensitive matching
-
Safety & Control
- 🧪 Dry-run simulation mode
- 🔒 Interactive deletion prompts
- 📝 Comprehensive logging
Installation 📦
pip install unclutter-directory
Usage 🚀
Basic Command Structure
unclutter organize [OPTIONS] TARGET_DIR [RULES_FILE]
unclutter validate [OPTIONS] RULES_FILE
Common Options
| Option | Description |
|---|---|
| --dry-run | Simulate actions without making changes |
| --quiet | Suppress non-error messages |
| --include-hidden | Process hidden files/directories |
| --always-delete | Skip confirmation for deletions |
| --never-delete | Prevent all deletion actions |
Example Workflow
- Create rules file (
cleanup_rules.yaml):
- name: "Cleanup Old Downloads"
conditions:
older: "30d"
action:
type: delete
- name: "Organize Media Files"
is_directory: false
conditions:
regex: "\.(mp4|mov|avi)$"
action:
type: move
target: "media/"
- name: "Archive Projects"
is_directory: true
conditions:
end: "_project"
newer: "7d"
action:
type: compress
target: "archives/"
- Run organization:
unclutter organize ~/Downloads cleanup_rules.yaml --dry-run
Apply changes:
unclutter organize ~/Downloads cleanup_rules.yaml
Rules Configuration ⚙️
Rule Structure
- name: "Rule Name"
is_directory: false # Optional (default: false)
case_sensitive: false # Optional (default: false)
check_archive: true # Optional (default: false)
conditions:
start: "report_"
end: ".pdf"
larger: "10MB"
older: "2w"
action:
type: move
target: "documents/"
Condition Types
| Condition | Format | Examples |
|---|---|---|
| Time | <number><unit> |
30d, 2h, 15m |
| Size | <number><unit> |
500MB, 1GB, 100KB |
| Name | String/Regex | start: "temp_" |
Time Units: s (seconds), m (minutes), h (hours), d (days), w (weeks)
Size Units: B, KB, MB, GB
Advanced Usage 🔧
Archive Handling
Search inside compressed files:
- name: "Find Secret Documents"
check_archive: true
conditions:
regex: "top_secret.*\.docx$"
action:
type: move
target: "classified/"
Directory Compression
- name: "Archive Old Projects"
is_directory: true
conditions:
older: "6M"
action:
type: compress
target: "project_archives/"
Development 👩💻
Project Setup
git clone https://github.com/zirition/unclutter-directory
cd unclutter-directory
python -m venv .venv
source .venv/bin/activate # Linux/MacOS
# .venv\Scripts\activate # Windows
pip install -e .[dev] # Install with development dependencies
Testing
python -m unittest discover tests
License 📄
MIT License
Support 💬
For issues and feature requests, please open an issue.
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
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 unclutter_directory-0.9.4.tar.gz.
File metadata
- Download URL: unclutter_directory-0.9.4.tar.gz
- Upload date:
- Size: 18.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afff45ad95fa4572e5a8cc2960c0bbda92f683f42b51dbbc131ad0e0192efba4
|
|
| MD5 |
6d14303d4cfa80a04775a3fd37c3673c
|
|
| BLAKE2b-256 |
20ffa1c8f137cbe1a6b12ee30ea9903c7a7af7c66ad49cf78231a6bf93584ed2
|
Provenance
The following attestation bundles were made for unclutter_directory-0.9.4.tar.gz:
Publisher:
python-publish.yml on zirition/unclutter-directory
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unclutter_directory-0.9.4.tar.gz -
Subject digest:
afff45ad95fa4572e5a8cc2960c0bbda92f683f42b51dbbc131ad0e0192efba4 - Sigstore transparency entry: 171707853
- Sigstore integration time:
-
Permalink:
zirition/unclutter-directory@64978cf6be8aa1afa2f44982c3104bd8a2151bb5 -
Branch / Tag:
refs/tags/0.9.4 - Owner: https://github.com/zirition
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@64978cf6be8aa1afa2f44982c3104bd8a2151bb5 -
Trigger Event:
release
-
Statement type:
File details
Details for the file unclutter_directory-0.9.4-py3-none-any.whl.
File metadata
- Download URL: unclutter_directory-0.9.4-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f9cfdafe4212867ef844df28cd021bc32d78ec951a8864cba06079b4c40e8a7
|
|
| MD5 |
f6b81d280415d19b977967bb97d10d18
|
|
| BLAKE2b-256 |
414470c14d4a104d57f9c1b09910870c794ee90bfbf83c574ceacb56ab5db549
|
Provenance
The following attestation bundles were made for unclutter_directory-0.9.4-py3-none-any.whl:
Publisher:
python-publish.yml on zirition/unclutter-directory
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unclutter_directory-0.9.4-py3-none-any.whl -
Subject digest:
6f9cfdafe4212867ef844df28cd021bc32d78ec951a8864cba06079b4c40e8a7 - Sigstore transparency entry: 171707855
- Sigstore integration time:
-
Permalink:
zirition/unclutter-directory@64978cf6be8aa1afa2f44982c3104bd8a2151bb5 -
Branch / Tag:
refs/tags/0.9.4 - Owner: https://github.com/zirition
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@64978cf6be8aa1afa2f44982c3104bd8a2151bb5 -
Trigger Event:
release
-
Statement type: