#file-rename #rename

bin+lib ren3

Do file renaming using regular expressions

1 unstable release

0.1.0 Jan 3, 2019

#39 in #file-rename

MIT license

13KB
246 lines

ren3 Linux build status

Do file renaming using regular expressions.

Inspired by ren2

Install

cargo install ren3

Usage

USAGE:
    ren3 [FLAGS] <expression> [dir]...

FLAGS:
    -b, --brief             only display base name
    -D, --directory-only    only rename directories
    -F, --file-only         only rename files
    -f, --force             apply changes
    -h, --help              Prints help information
    -r, --recursive         rename subdirectories recursively
    -V, --version           Prints version information

ARGS:
    <expression>    sed-like expression
    <dir>...        directories to rename

Examples

> ls
foo-1.jpg foo2.jpg

> ren3 's/.*(\d+\.jpg)/bar-$1' -f
[OK] ./foo2.jpg      -> ./bar-2.jpg
[OK] ./foo-1.jpg     -> ./bar-1.jpg

> ls
bar-1.jpg  bar-2.jpg

Dependencies

~4–12MB
~122K SLoC