octrow/ollama-rename-files
About
Rename messy files by their content with a local Ollama model: CLI and desktop GUI, no API keys, originals backed up.
AI & Machine LearningWhat you can do
- 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.
Measured star growth
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- +1
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalOllama File Renamer
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).

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
- Finds files that match the pattern: the prefix as a whole word (
newtakesnew1.txt, notnewsletter.txt) and the extension. - Copies each file into
backup_<timestamp>/in that folder. - Sends the first
--contextcharacters of the file (of its text, for a PDF) to your Ollama model. - Picks the name out of the reply and cleans it: lowercase, safe characters, at most 128 characters.
- Renames the file, keeping its extension and never overwriting.
- 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
Explore related projects
Loading…