A Safe & Powerful Batch File Renamer with Regex Magic ✨
Transform your files like a wizard! 🧙
- 🎯 Precision Matching with regex patterns
- 🔄 Smart Replacement using capture groups
- 👮 Safety First - Interactive confirmation & dry-run preview
- 🚀 Blazing Fast - Built with Rust performance
- 📦 Cross-Platform - Works on Windows/macOS/Linux
- 📝 Visual Feedback - Colorized diff previews
cargo install --git https://github.com/Intro-iu/exrn.git
git clone https://github.com/Intro-iu/exrn.git
cd exrn
cargo install --path .
exrn -s "GLOB_PATTERN" -r "SOURCE_REGEX" "TARGET_PATTERN" [OPTIONS]
Option | Description |
---|---|
-s, --sources |
File glob patterns (e.g., *.txt ) |
-r, --rule |
Regex match and replacement pattern |
-y, --yes |
Auto-confirm all actions |
exrn -s "*.txt" -r '^(.*)\.txt$' '$1.md'
Interactive Output:
Matching files...
[1] notes.txt => notes.md
[2] draft.txt => draft.md
Planned changes (2 files):
Do you want to proceed with the renaming? [y/N]: y
Renaming completed! 2/2 files successfully renamed
exrn -s "temp_*" -r 'temp_' 'final_' -y
Output:
Auto-confirm enabled
[1] temp_file1 => final_file1
[2] temp_file2 => final_file2
Renamed 2 files successfully
exrn -s "*.log" -r '(\d{4})-(\d{2})-(\d{2})' '$2$3$1'
📆 Converts 2023-08-15.log
→ 08152023.log
exrn includes multiple protection layers:
if source == target { /* Skip identical paths */ }
if target.exists() { /* Prevent overwrites */ }
if new_name.is_empty() { /* Block empty names */ }
This project is licensed under the MIT License - see the LICENSE file for details.
💡 Pro Tip: Always check the preview before confirming!
🐞 Found an issue? Report it here
⭐ Love exrn? Give us a star on GitHub!