A macOS-based batch file renaming tool that uses Finder’s Quick Look (Space-bar preview) to show each file before renaming.
Designed for human-in-the-loop workflows. Instead of bulk renaming blindly, peek-rename previews every file, asks for user input, and then renames or copies the file accordingly.
(If you are looking for an AI-based renamer that generates keywords based on file contents or image contents, you can use: ai-rename-files.)
- Iterates over any file type in a directory
- Uses Finder-style Quick Look preview (
qlmanage -p) - Terminal or GUI-based (via applescript) text input
- Optional auto-numbering (
01_,02_, …) - Append to or replace filenames
- Rename or copy files
- macOS
- Bash (compatible with the default macOS Bash 3.2 or higher)
- Quick Look (
qlmanage, built-in) - AppleScript (
osascript, built-in)
No Homebrew or external dependencies required.
chmod +x install.sh
./install.shAfter running this, restart your terminal.
Clone the repository and make the script executable:
git clone https://github.com/yourname/peek-rename.git
cd peek-rename
chmod +x peek-renameOptionally place it somewhere on your PATH:
mv peek-rename ~/.local/bin/peek-rename <directory-with-files>(Note that if no directory is provided, the current directory is used.)
For each file:
- The file is previewed using Quick Look (the same as if you press the space bar on Finder)
- You enter a description
- The file is renamed (or copied) with this new name as the description
Some additional (very helpful) behavior is opt-in via command line arguments.
| Option | Description |
|---|---|
-i, --inc |
Auto-number files (01_, 02_, …) |
-a, --append |
Append text instead of replacing filename |
-c, --copy |
Copy file instead of renaming |
-g, --gui |
Use GUI dialog for text input |
Enable GUI mode with:
peek-rename --guiBehavior in GUI mode:
- File is previewed using Quick Look
- A dialog appears with buttons:
- Rename: apply description and rename/copy file
- Skip: skip the file
- Back: return to the previous file
- Cancel or Esc: quit immediately (Note: this needs testing)
- Preview closes after the action
peek-rename --incProduces filenames like:
01_description.jpg
02_description.jpg
peek-rename --appendPreserves the original filename:
originalname_description.pdf
Can be combined with numbering:
peek-rename --inc --append01_originalname_description.pdf
peek-rename --copy- The original file is left untouched
- A new file is created with the new name
-qlmanage -p achieves the same preview mechanism Finder does when you press spacebar
- GUI dialogs are implemented with AppleScript, you can change it to python-based/etc but will require non-shell scripting tools
- Filenames are sanitized to avoid invalid characters (needs testing)
GNU General Public License (GPL)