Skip to main content

kaif-file-organizer

CI

PyPI version

Python Versions

License: MIT

A safe, general-purpose local file organizer and file-management CLI that categorizes your files securely and predictably.

Why this project exists

Managing a cluttered Downloads or Documents folder manually is tedious, but using automated scripts is often dangerous. Most quick-and-dirty file organizers blindly move files, leading to accidental overwrites, silent deletions, or broken symlinks.

kaif-file-organizer was built to provide a production-grade, safety-first approach to file organization. It guarantees that your files will never be automatically deleted or silently overwritten. It is designed to be a reliable utility for your daily workflow, offering dry-runs, collision detection, and extensive configurability.

Features

  • Safe by Default: Never deletes files automatically. Never silently overwrites files.
  • Dry-run Mode: See what would happen before actually moving anything.
  • Duplicate Handling: Safely handles file collisions (file (1).ext) and skips exact identical duplicates using MD5 hashing.
  • Configurable: Use sensible defaults or provide your own JSON configuration for custom categories.
  • Recursive Mode: Explicitly opt-in to process subdirectories.
  • Hidden/System Files: Safely ignores hidden files (starting with .) and symlinks by default.

Prerequisites

  • Python 3.12 or higher

Installation

You can install this tool using pipx (recommended) or pip:

# Recommended: Install isolated via pipx
pipx install kaif-file-organizer

# Alternatively, install via pip
pip install kaif-file-organizer

Usage

Organize a directory:

file-organizer ~/Downloads

Preview changes without moving files:

file-organizer ~/Downloads --dry-run

Organize a directory and its subdirectories:

file-organizer ~/Downloads --recursive

Use a custom configuration:

file-organizer ~/Downloads --config my_categories.json

Skip confirmation prompts (for automation):

file-organizer ~/Downloads --yes

Configuration

By default, files are organized into standard categories (Documents, Images, Videos, Audio, Archives, Code, etc.). You can override these by creating a custom JSON configuration file:

{
  "Photos": [".jpg", ".png", ".heic"],
  "Work": [".pdf", ".docx", ".xlsx"],
  "Music": [".mp3", ".wav"]
}

And passing it via --config:

file-organizer ~/Downloads --config config.json

Safety

File manipulation is potentially destructive, which is why file-organizer implements strong safety defaults:

  • Dry-run (--dry-run): Shows planned changes.
  • No silent overwrites: Filename collisions in the destination are handled gracefully (file (1).txt).
  • No automatic deletion: The tool will not delete any files or directories.
  • No hidden/system file moves: Hidden files and symbolic links are ignored by default.

Development

Clone the repository and install it in development mode:

git clone https://github.com/techykaif/file-organizer.git
cd file-organizer
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

Running Tests

Execute the test suite using pytest:

pytest tests/

Running Ruff

Run linting and formatting checks:

ruff check .

Building the Package

Build the source distribution and wheel:

python -m pip install build
python -m build

Project Structure

src/
└── file_organizer/
    ├── __init__.py      # Package metadata
    ├── cli.py           # CLI entry point and argument parsing
    ├── config.py        # Default categories and configuration loading
    └── organizer.py     # Core file moving and safety logic
tests/
├── test_cli.py          # CLI integration tests
└── test_organizer.py    # Unit tests for core logic

Release & Development Workflow

This project uses standard GitHub Actions for CI and CD.

  • Tests: Automatically run on every push and pull request to main.
  • Releases: Managed via GitHub Releases. Publishing a new release triggers the PyPI Trusted Publishing workflow (release.yml), which builds and uploads the package to PyPI securely via OIDC.

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for details on how to set up your environment, run tests, and submit pull requests.

Links

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for kaif-file-organizer 0.1.3

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

Source distribution (sdist)

Source distribution for kaif-file-organizer 0.1.3
File Size Uploaded
kaif_file_organizer-0.1.3.tar.gz 11.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kaif-file-organizer 0.1.3
File Interpreter ABI Platform
kaif_file_organizer-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 21.2 kB

Release files / kaif_file_organizer-0.1.3.tar.gz

Download URL kaif_file_organizer-0.1.3.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
cd3c4e74546e94c6e18b87f3e42e8576a295b7d6a2689ca19c1af4dcdf8599a1
BLAKE2b-256 checksum
How to use checksums
969576ecb62e5d02059dbe0efa30bfb92dd360e4d8852ea7810eb54041f55ce8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 10, 2026.

Transparency log

Release files / kaif_file_organizer-0.1.3-py3-none-any.whl

Download URL kaif_file_organizer-0.1.3-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bab131714d50feb36e1fed755bd946403f6669d01b0f44825bbdd91ac0024887
BLAKE2b-256 checksum
How to use checksums
e8e5fcf511244b24f5d31c626547fa5af4a95ef491c718467a8fee8228114aad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

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