Batch File Rename reads a local folder using your browser's File System Access API, applies search-and-replace rules (including full regex) to preview the new names in real time, then generates a rename script — a .bat file on Windows or a .sh file on macOS/Linux — that you run locally to do the actual renaming. Only desktop Chromium-based browsers (Chrome, Edge, Opera) support the API this tool requires.
Writing Search and Replace Rules
The simplest usage: type what to find in the Search field, type the replacement in the Replace field, leave Replace empty to delete all matches.
Enable "Use Regular Expression" for full regex support. Capture groups in the search pattern can be referenced as $1, $2, etc. in the Replace field.
Common regex patterns:
| Goal | Search | Replace |
|---|---|---|
| Remove parenthesized content | \s*\([^)]*\) | (leave empty) |
| Swap prefix and number | ^(.+)_(\d+)\.(.+)$ | $2-$1.$3 |
| Add a fixed prefix | ^(.+)$ | prefix_$1 |
| Keep only the number | ^.*?(\d+).*$ | $1 |
Controlling What Gets Renamed
The "Apply to" setting determines which part of the filename the rule acts on:
- Full filename — rule applies to both the name and the extension, useful for case normalization or full replacements
- Filename only — extension is untouched, useful when you want to keep
.jpg,.pdf, etc. unchanged - Extension only — name is untouched, useful for fixing mixed-case extensions like
.JPG→.jpg
You can also limit the rule to only files, only folders, or only subfolders, so renaming folders doesn't accidentally affect file names and vice versa.
Running the Generated Script
After clicking "Generate Script", the file (click-to-rename.bat or click-to-rename.sh) is saved into the selected folder:
- Windows: double-click the
.batfile - macOS / Linux: run
chmod +x click-to-rename.sh && ./click-to-rename.shin Terminal, or double-click if your system allows it
The script prints a completion message and deletes itself when finished.