Skip to main content

Organize your files with natural language instructions powered by AI

Project description

๐Ÿ—‚๏ธ ai-file-organizer

Organize any folder with a single natural language command โ€” in English or Japanese.

CI License: MIT

$ file-org "ใƒ€ใ‚ฆใƒณใƒญใƒผใƒ‰ใƒ•ใ‚ฉใƒซใƒ€ใ‚’็จฎ้กžๅˆฅใซๆ•ด็†ใ—ใฆ" ~/Downloads --dry-run

  Organization Plan
  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚ Source              โ”‚ โ†’ Destination        โ”‚ Reason               โ”‚
  โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
  โ”‚ photo_2026.jpg      โ”‚ images/photo_2026... โ”‚ JPEG image file      โ”‚
  โ”‚ invoice_jan.pdf     โ”‚ documents/invoice... โ”‚ PDF document         โ”‚
  โ”‚ setup.exe           โ”‚ installers/setup.exe โ”‚ Windows installer    โ”‚
  โ”‚ vacation.mp4        โ”‚ videos/vacation.mp4  โ”‚ MP4 video file       โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

  Proceed with moving 4 file(s)? [y/N]:

โœจ Features

  • Natural language instructions โ€” type what you want, in any language
  • Dry-run mode โ€” always preview before touching the filesystem
  • Safe by design โ€” never overwrites files (auto-renames conflicts), never deletes
  • OpenAI & X.AI (Grok) support โ€” plug in the API key you already have
  • Structured LLM output โ€” deterministic JSON schema, not fragile text parsing
  • Japanese (ๆ—ฅๆœฌ่ชž) fully supported โ€” instructions, folder names, filenames
  • Beautiful terminal UI โ€” powered by Rich
  • Configurable โ€” exclude patterns, max files, per-project .file-organizer.toml

๐Ÿ“ฆ Installation

pip / pipx (recommended)

# One-off use (recommended โ€” keeps your global Python clean)
pipx install ai-file-organizer

# Or with pip
pip install ai-file-organizer

Homebrew (macOS / Linux)

# Coming soon โ€” tap will be added after first PyPI release
brew install youi2000jp4/tap/ai-file-organizer

From source

git clone https://github.com/youi2000jp4/ai-file-organizer.git
cd ai-file-organizer
pip install -e ".[dev]"

๐Ÿš€ Quick Start

1. Set your API key

# OpenAI
file-org config set-key sk-...

# Or X.AI (Grok)
file-org config set-key xai-... --provider xai
file-org config set provider xai

# Or use environment variables
export OPENAI_API_KEY=sk-...

2. Organize!

# Preview first (always a good idea)
file-org "Sort by file type" ~/Downloads --dry-run

# Execute with confirmation
file-org "ใƒ€ใ‚ฆใƒณใƒญใƒผใƒ‰ใƒ•ใ‚ฉใƒซใƒ€ใ‚’็จฎ้กžๅˆฅใซๆ•ด็†ใ—ใฆ" ~/Downloads

# Skip confirmation prompt
file-org "Move PDFs to documents folder" ~/Desktop --yes

# Recursive (including subdirectories)
file-org "Group photos by year" ~/Pictures --recursive

# Use a different model
file-org "Clean up" --model gpt-4o

๐Ÿ“– Command Reference

Usage: file-org [OPTIONS] INSTRUCTION [TARGET]

  Organize files with a natural language instruction.

Arguments:
  INSTRUCTION  Natural language instruction (Japanese OK)  [required]
  TARGET       Target directory  [default: current directory]

Options:
  -n, --dry-run       Preview changes without moving files
  -y, --yes           Skip confirmation prompt
  -r, --recursive     Scan subdirectories recursively
  -m, --model TEXT    Override LLM model
  --max-files INT     Max files to send to LLM  [default: 300]
  --help              Show this message and exit.

Config subcommands:
  file-org config show              Show current configuration
  file-org config set-key KEY       Save API key
  file-org config set KEY VALUE     Set a config option
  file-org config init              Create default config file

โš™๏ธ Configuration

Config is stored at ~/.config/file-organizer/config.toml.
API keys are stored in ~/.config/file-organizer/.env (chmod 600 โ€” never committed).

# ~/.config/file-organizer/config.toml
provider = "openai"          # "openai" or "xai"
model = "gpt-4o-mini"        # any model your provider supports
max_files = 300              # max files per LLM call
confirm_before_execute = true
exclude_patterns = [".DS_Store", "*.pyc", "node_modules"]

Per-project override

Place a .file-organizer.toml in any directory to override settings for that project:

# .file-organizer.toml
exclude_patterns = [".git", "*.log", "tmp"]
max_files = 50

๐Ÿ›ก๏ธ Safety

Risk Mitigation
Accidental overwrite Files are never overwritten โ€” conflicts get a numeric suffix (file_1.txt)
Accidental delete The tool only moves files. Deletion is not possible.
Hidden files Hidden files (.dotfiles) are skipped unless explicitly included
Too many files max_files limits LLM context. Extra files are skipped with a warning.
API errors All LLM errors surface clearly; filesystem is not touched on failure

Recommended workflow: always run with --dry-run first, review the table, then re-run without it.


๐Ÿค Contributing

Contributions are welcome! See CONTRIBUTING.md for details.

git clone https://github.com/youi2000jp4/ai-file-organizer.git
cd ai-file-organizer
pip install -e ".[dev]"
pytest          # run tests
ruff check .    # lint

๐Ÿ“„ License

MIT ยฉ ai-file-organizer contributors

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

ai_file_organizer-0.1.1.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

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

ai_file_organizer-0.1.1-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file ai_file_organizer-0.1.1.tar.gz.

File metadata

  • Download URL: ai_file_organizer-0.1.1.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ai_file_organizer-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b058508b8e2b6c0f49f91ea8845668afa55b7b4cd89fee0f030b2050f7c38401
MD5 22f30922341f8be19844a456cd81d883
BLAKE2b-256 91a0c409d053dcef101e200f994f857c74cbe7f172d118bd7b9a8cc7d1955253

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_file_organizer-0.1.1.tar.gz:

Publisher: release.yml on youi2000jp4/ai-file-organizer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ai_file_organizer-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ai_file_organizer-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dfc003b488df70ce655e8afa843d666f58563b280941784904bda2ffafef712c
MD5 866fc5c8b1fdfecfb8ebbb656f5710a3
BLAKE2b-256 b884e5b597cf92f31548abf9c7024e9be901266768c7bb1329d6f2600139137a

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_file_organizer-0.1.1-py3-none-any.whl:

Publisher: release.yml on youi2000jp4/ai-file-organizer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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