Thanks to visit codestin.com
Credit goes to lib.rs

4 releases

0.1.3 Aug 21, 2025
0.1.2 Aug 21, 2025
0.1.1 Aug 7, 2025
0.1.0 Aug 6, 2025

#1055 in Command line utilities

Codestin Search App Codestin Search App

138 downloads per month

Apache-2.0

16KB
389 lines

rrn: regex-repalce-name

Chinese version

batch rename files/dirs by regex.

Tribute to f2.

Currently, it has an issue #120 which it cannot replace filenames or folders containing spaces.

However, this is a common usage scenario. As a temporary solution, I've created a small tool to address this.

It's just a simple toy.

Usage

$ rrn
------------------------------------------------------
rrn	a rename file / directory tool.

	-f <pattern>, necessary: true
		from pattern
	-t <pattern>, necessary: true
		to pattern
	-d, optional, default: none
		rename directories or files, default is rename files.
	-x, optional, default: dry run
		execution the rename process
	-h, output help message
	-v, output version info
------------------------------------------------------ 

Example

$ ls
acca.txt  accca.txt  acccca.txt  a.txt

$ rrn -f a -t b
------------------------------------
| from       | to         | status |
------------------------------------
| a.txt      | b.txt      | OK     |
| acccca.txt | bccccb.txt | OK     |
| accca.txt  | bcccb.txt  | OK     |
| acca.txt   | bccb.txt   | OK     |
------------------------------------
This is dryrun. Execute with '-x' to execute.

$ rrn -f a -t b -x
Move "a.txt" => "b.txt"
Move "acccca.txt" => "bccccb.txt"
Move "accca.txt" => "bcccb.txt"
Move "acca.txt" => "bccb.txt" 

Change Log

change log

Dependencies

~8–20MB
~237K SLoC