SkillAgentSearch skills...

Brename

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

Install / Use

/learn @shenwei356/Brename
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

brename: batch renaming safely

Built with GoLang Go Report Card Cross-platform Latest Version Github Releases

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

<img src="screenshot/success.png" width="700"/>

Table of Contents

<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- END doctoc generated TOC please keep comment here to allow auto update -->

Features

  • Cross-platform. Supporting 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 potential conflicts and errors before it's too late.

    <img src="screenshot/check-error.png" width="700"/>

    Some common conflict and errors that might happen with commands like mv or rename.

    • New path existed: Existed files might be overwritten, causing data loss.
    • Overwriting newly renamed path. Existed files might be overwritten, causing data loss. This case is hard to check by eyes.
    • Missing target: New file is empty, that's 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 run. A good habbit.

    <img src="screenshot/dry-run.png" width="700"/>
  • Supporting Undo the LAST successful operation, like a time machine.

    <img src="screenshot/undo.png" width="700"/>
  • Overwrite can be detected and users can choose whether overwrite or leave it (-o/--overwrite-mode).

  • File filtering.

    • Supporting including (-f/--include-filters) and excluding (-F/--exclude-filters) files via regular expression.
    • No need to run commands like find ./ -name "*.html" -exec CMD.
  • Renaming submatch with corresponding value via key-value file (-r "{kv}" -k kv.tsv).

  • Renaming via ascending integer (-r "{nr}").

  • Automatically making directoy: 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 Go programming language, executable binary files for most popular operating systems are freely available in release 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.14.0 Github Releases (by Release)

Tip: run brename -V to check update !!!

OS |Arch |File, 中国镜像 |Download Count :------|:---------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Linux |32-bit |brename_linux_386.tar.gz,<br/> 中国镜像 |Github Releases (by Asset) Linux |64-bit|brename_linux_amd64.tar.gz,<br/> 中国镜像 |Github Releases (by Asset) Linux |arm64 |brename_linux_arm64.tar.gz,<br/> 中国镜像 |Github Releases (by Asset) OS X |64-bit|brename_darwin_amd64.tar.gz,<br/> 中国镜像 |Github Releases (by Asset) OS X |arm64 |brename_darwin_arm64.tar.gz,<br/> 中国镜像 |Github Releases (by Asset) Windows|32-bit |brename_windows_386.exe.tar.gz,<br/> 中国镜像 |Github Releases (by Asset) Windows|64-bit|brename_windows_amd64.exe.tar.gz,<br/> 中国镜像|Github Releases (by Asset)

Just download compressed executable file of your operating system, and decompress it with tar -zxvf *.tar.gz command or other tools. And then:

  1. For Linux-like systems

    1. If you have root privilege simply copy it to /usr/local/bin:

       sudo cp brename /usr/local/bin/
      
    2. Or copy to anywhere in the environment variable PATH:

       mkdir -p $HOME/bin/; cp brename $HOME/bin/
      
  2. For windows, just copy brename.exe to C:\WINDOWS\system32.

Method 2: Homebrew

brew install brename

Method 3: For ArchLinux AUR users

yaourt -S brename

Method 4: For Scoop users

scoop install brename

Method 5: Compiling from source

# download Go from https://go.dev/dl
wget https://go.dev/dl/go1.24.2.linux-amd64.tar.gz

tar -zxf go1.24.2.linux-amd64.tar.gz -C $HOME/

# or 
#   echo "export PATH=$PATH:$HOME/go/bin" >> ~/.bashrc
#   source ~/.bashrc
export PATH=$PATH:$HOME/go/bin

git clone https://github.com/shenwei356/brename
cd brename

go build

# or statically-linked binary
CGO_ENABLED=0 go build -tags netgo -ldflags '-w -s'

# or cross compile for other operating systems and architectures
CGO_ENABLED=0 GOOS=openbsd GOARCH=amd64 go build -tags netgo -ldflags '-w -s'

Usage


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

Version: 2.14.0

Author: Wei Shen <shenwei356@gmail.com>

Homepage: https://github.com/shenwei356/brename

Warnings:
  1. The path in file systems like FAT32 or NTFS is case-insens
View on GitHub
GitHub Stars297
CategoryDevelopment
Updated1mo ago
Forks21

Languages

Go

Security Score

100/100

Audited on Feb 20, 2026

No findings