PDF Renamer AI
A Rust CLI tool that automatically renames PDF files with meaningful, concise names using local LLMs via Ollama. Perfect for organizing documents with non-English filenames or long, complex names.
Features
- đ Multi-language Support: Automatically translates non-English filenames
- đ¤ Local LLM Integration: Uses Ollama for privacy-preserving AI processing
- đ Automatic Setup: Installs Ollama and downloads models as needed
- đ Batch Processing: Processes entire directories recursively
- đ Safe Operations: Dry-run mode by default, duplicate handling
- ⥠Fast & Efficient: Written in Rust for optimal performance
Quick Start
# Clone and build
# Run the demo
# Or use directly
Installation
Prerequisites
- Rust (1.70 or later)
- macOS or Linux (Windows support coming soon)
- Internet connection (for automatic Ollama setup and model downloads)
Install from crates.io (Recommended)
This will install the pdf-renamer command globally.
Build from Source
The binary will be available at target/release/pdf-renamer.
Install from Source
Usage
Basic Usage
# Dry run - see what would be renamed
# Actually rename files
Using Different Models
# Use a specific model (default: qwen3:latest)
# Available models:
# - command-r7b:latest (recommended - best results)
# - qwen3:latest (default)
# - deepseek-r1:latest
# - gemma3n:e4b
# - mistral-nemo:latest
Command Line Options
USAGE:
pdf-renamer [OPTIONS] <FOLDER_PATH>
ARGS:
<FOLDER_PATH> Path to the folder containing PDF files
OPTIONS:
-r, --rename Actually rename the files (dry run by default)
-m, --model <MODEL> Ollama model to use [default: qwen3:latest]
-h, --help Print help information
How It Works
-
Setup Phase:
- Checks if Ollama is installed (installs if needed)
- Ensures Ollama service is running
- Downloads the specified model if not available
-
Processing Phase:
- Scans the directory for PDF files
- Sends each filename to the LLM for translation/summarization
- Generates a meaningful 10-character alphanumeric name
- Renames files (if --rename flag is used)
-
Safety Features:
- Dry-run by default
- Handles duplicates by appending numbers
- Preserves original files on error
Examples
Before
Ų
ØĩØą_Ų
Ų_ŲØ§ØĩØą_ØĨŲŲ_ØØąØ¨_ØŖŲØĒŲØ¨Øą.pdf
ããããįžåŽä¸ģįžŠč
ãŽãããŽéåčĢ.pdf
Introduction_to_Machine_Learning_2024_Edition.pdf
After
egyptwar.pdf
quantumphy.pdf
mlintro24.pdf
Automatic Ollama Setup
The tool automatically handles Ollama installation and configuration:
- â Detects if Ollama is installed
- â Installs Ollama if missing (macOS/Linux)
- â Starts Ollama service if not running
- â Downloads required models automatically
- â Shows progress during model downloads
Development
Project Structure
pdf_renamer/
âââ src/
â âââ main.rs # CLI and main logic
â âââ ollama.rs # Ollama API client
â âââ setup.rs # Ollama setup automation
âââ Cargo.toml
âââ README.md
Running Tests
Building for Release
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under a custom license that requires attribution for commercial use - see the LICENSE file for details.
Key points:
- â Free for personal and commercial use
- â Can modify and distribute
- â ī¸ Commercial use requires attribution
- â Non-commercial use doesn't require attribution (but it's appreciated)
Author
Created by Hamzeh Ghalebi (ghalebi@gmail.com)
Acknowledgments
- Ollama for providing local LLM capabilities
- The Rust community for excellent libraries and tools
- All contributors and users of this project
Troubleshooting
Ollama Installation Fails
- Ensure you have
curlinstalled - Check your internet connection
- Try installing Ollama manually from https://ollama.com
Model Download Issues
- Ensure you have sufficient disk space (models can be 1-10GB)
- Check your internet connection
- Try pulling the model manually:
ollama pull model-name
Permission Errors
- Ensure you have write permissions in the PDF directory
- Run with appropriate permissions if needed
Roadmap
- Windows support
- Configuration file support
- Custom naming patterns
- Progress bar for large directories
- GUI version
- Integration with cloud storage services
- Batch undo functionality
Support
If you encounter any issues or have questions, please:
- Check the Issues page
- Create a new issue with details about your problem
- Include your OS, Rust version, and any error messages