shenwei356 /brename

A practical cross-platform command-line tool for safely batch renaming files/directories via regular expression

★ 301⑂ 23👁 3⑃ 9● 33▤ 25
GoMITCreated 2013-09-06github.com/shenwei356/brename
Download: brename v2.15.0brename-2.15.0 ↓2.15.02026-10-30
+1
Daily
+1
Weekly
301
stars
23
forks
3
watchers
9
prs
33
issues
25
releases

README

brename: batch renaming safely






brename is a cross-platform command-line tool for safely batch renaming files/directories via regular expressions.



 Table of Contents



- Features
- Installation
- Usage
- Examples
- Real-world examples
- FAQS
- Contact
- License
- Starchart



 Features

- Cross-platform. Supports Windows, Mac OS X and Linux.
    - Windows file systems, including NTFS and FAT, are case-insensitive.
    Some operations are allowed on Linux, while they could be dangerous on Windows.
    For example, renaming test.tar.gz to test.tar will overwrite TEST.tar. 
    brename (v2.13.0 and later versions) can handle these cases appropriately (-w and -W).

- Safe. It helps you check for potential conflicts and errors before it's too late.

    

    Some common conflicts and errors that might happen with commands like mv or rename:

    - New path existed: Existing files might be overwritten, causing data loss.
	- Overwriting newly renamed path. Existing files might be overwritten, causing data loss.
       This case is hard to check by eye.
	- Missing target: The new filename is empty, which is not allowed.
	- New path ending with a space: Not allowed in Windows. It's legal in Linux, but might cause unexpected errors.
	- New path ending with a period: Not allowed in Windows.

- Supporting dry runs. A good habit.

    

- Supporting Undo for the last rename operation, including completed moves from a failed run.

    

- Overwrites can be detected and users can choose whether to overwrite or skip them (-o/--overwrite-mode).
- File filtering.
    - Supports including (-f/--include-filters) and excluding (-F/--exclude-filters) files via regular expressions.
    - No need to run commands like find ./ -name ".html" -exec CMD.
- Renaming submatches with corresponding values via a key-value file (-r "{kv}" -k kv.tsv).
- Renaming via ascending integers (-r "{nr}").
- Automatically making directories: e.g., renaming a-b-c.txt to a/b/c.txt.
- Recursively renaming both files and directories (-R/--recursive, -D/--including-dir, --only-dir).



 Installation

brename is implemented in the Go programming language;
 executable binary files for most popular operating systems are freely available
  on the releases page.

 Method 0: Conda

Install conda, then run

    conda install -c conda-forge brename

Or use mamba, which is faster.

    mamba install -c conda-forge brename

 Method 1: Download binaries

brename v2.15.0


Tip: run brename -V to check for updates!

Version checks wait up to 30 seconds for GitHub and report network or HTTP errors.
A release that differs from the installed version is shown as the latest release;
it may be older than a local development build.

OS     |Arch      |File                                                                                                                                      |Download Count
:------|:---------|:------------------------------------------------------------------------------------

Top issues

Latest release

brename v2.15.0 v2.15.0 2026-10-30
- v2.15.0
    - flag -N/--nature-sort now applies to renaming as well as listing. 36
    - fix: correct exclude-filter assignment and recursive filtering, handle explicit search paths and --only-dir consistently, and inspect metadata without reading file contents. Exclude-filter assignment fix by @mazkev. 41
    - fix: validate normalized target names and conflicts, preserve symlink and .. resolution, distinguish hard links, reject moving directories into their own descendants, and protect the working directory, its ancestors, dangling symlinks, and undo log paths during execution and renam

Snapshot: 2026-11-27T22:26:53Z · Data license Apache-2.0 · JSON