Skip to main content

Ollama File Renamer

CI PyPI MIT license

Ollama File Renamer: new2.txt becomes docs-update-backend-migration-plan.txt

English | Русский

Rename messy files by their content with a local Ollama model.

new2.txt becomes docs-update-backend-migration-plan.txt. It runs as a desktop window or a command-line tool. It needs no API keys and copies every original to a backup folder first.

Made for folders of notes and drafts named Untitled, new, copy (3).

Desktop window after a run: seven new*.txt files renamed by qwen2.5-coder:1.5b, originals in a backup folder

Features

  • File contents go only to your own Ollama.
  • Originals are copied to backup_<timestamp>/ first. A rename never overwrites a file: it adds -1, -2, ...
  • The desktop window shows exactly which files will change, then fills in each new name.
  • It groups the folder into patterns (new*.txt, Untitled*.md). Pick one or type a prefix and extension.
  • Any installed model works. Reasoning models too: their <think> output is stripped.
  • The CLI renames several files at once (-p 4).
  • Reads text files and the text layer of PDFs (--ext .pdf). Scanned PDFs, binary and empty files are skipped with a reason.

Install

You need Ollama running with one model pulled:

ollama pull qwen2.5-coder:7b

Then install the app. It sets up uv, Python and ollama-rename in your user folder, no admin rights needed.

macOS / Linux:

curl -LsSf https://raw.githubusercontent.com/octrow/ollama-rename-files/main/install.sh | sh

Windows (PowerShell):

powershell -ExecutionPolicy ByPass -c "irm https://raw.githubusercontent.com/octrow/ollama-rename-files/main/install.ps1 | iex"

Have Python 3.10+? Run uv tool install ollama-rename-files (or pipx install ollama-rename-files).

Other ways, updating and uninstalling: docs/install.md. Standalone builds are on the releases page.

Usage

Open the desktop window:

ollama-rename gui

Browse to a folder, pick a pattern, choose a model and click Rename N files. Stop halts the run after the current file.

Or use the command line:

# Interactive: asks for folder, pattern, model and context length
ollama-rename

# No prompts: every new*.txt file in the folder, four at a time
ollama-rename -a -d ~/notes/inbox --prefix new --ext .txt -p 4

Ollama on another machine? Set OLLAMA_HOST, e.g. OLLAMA_HOST=http://192.168.1.20:11434 ollama-rename.

All options, the window's port and Linux notes: docs/usage.md.

How it works

  1. Finds files that match the pattern: the prefix as a whole word (new takes new1.txt, not newsletter.txt) and the extension.
  2. Copies each file into backup_<timestamp>/ in that folder.
  3. Sends the first --context characters of the file (of its text, for a PDF) to your Ollama model.
  4. Picks the name out of the reply and cleans it: lowercase, safe characters, at most 128 characters.
  5. Renames the file, keeping its extension and never overwriting.
  6. Logs every action and lists the files that failed and why.

Names look like task-fix-backend-resolve-database-connection-issue.txt. The naming pattern and the prompt are in docs/usage.md. Full step-by-step map of the code: docs/logic-map.md.

How it differs from ai-renamer

ai-renamer is a popular Node.js CLI. It also renames images and videos, and it talks to Ollama, LM Studio and OpenAI. Pick it for photos or a cloud model.

Ollama File Renamer does less: text files, PDFs and local Ollama only. It adds a window that previews the exact files, a backup of every original, no overwriting, and pattern discovery.

Development

uv sync
uv run pytest
uv run ruff check .

See CONTRIBUTING.md. Security reports go through SECURITY.md.

License

MIT

Metadata

Release files for ollama-rename-files 0.3.9

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

Source distribution (sdist)

Source distribution for ollama-rename-files 0.3.9
File Size Uploaded Provenance Actions
ollama_rename_files-0.3.9.tar.gz 117.9 kB With provenance Details for ollama_rename_files-0.3.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ollama-rename-files 0.3.9
File Interpreter ABI Platform Actions
ollama_rename_files-0.3.9-py3-none-any.whl Python 3 none any Details for ollama_rename_files-0.3.9-py3-none-any.whl

Total release size: 142.2 kB

Release files / ollama_rename_files-0.3.9.tar.gz

Download URL ollama_rename_files-0.3.9.tar.gz
Size 117.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a1b9185f30b6b1db66a61ccf77db886f990dfb7c4c90076de90b13d5fe7521e5
BLAKE2b-256 checksum
How to use checksums
c71849df8d10a6886c23de17fd042c1922c548de67f202ee43f6ebbeca7d7226
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 Nov 5, 2026.

Transparency log

Release files / ollama_rename_files-0.3.9-py3-none-any.whl

Download URL ollama_rename_files-0.3.9-py3-none-any.whl
Size 24.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2439dddb3d8d1720e2966a1ca166faddb5b88172b96a7148385754aadeae059a
BLAKE2b-256 checksum
How to use checksums
d253912bba983772a06d9123dc662a76958e8390aea313f781a0c440c7fcac65
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 Nov 5, 2026.

Transparency log

Security for ollama-rename-files 0.3.9

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ollama_rename_files-0.3.9.tar.gz

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 Nov 5, 2026.

Transparency log

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.

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