Batch rename utility for developers
You can download a pre-compiled executable for Linux, MacOS and Windows operating systems, then you should copy that executable to a location from your $PATH
env:
You might run chmod +x nomino-linux-64bit
or chmod +x nomino-macos-64bit
.
You can use nominoAUR or nomino-binAUR packages to install nomino in Arch Linux.
The nominoAUR package depends on rust package, if you have installed rust
using rustup
, then use makepkg -dsi
to install it by ignoring dependencies.
If you prefer to build nomino manually, or a pre-compiled executable is not provided for your target, then you can build nomino from scratch:
curl -sSf https://sh.rustup.rs | sh
cargo install nomino
```bash USAGE: nomino [FLAGS] [OPTIONS] [OUTPUT]
FLAGS: -e, --extension Preserves the extension of input files in 'sort' and 'regex' options -h, --help Prints help information -w, --overwrite Overwrites output files, otherwise, a '_' is prepended to filename -p, --print Prints the map table to stdout -t, --test Runs in test mode without renaming actual files -V, --version Prints version information
OPTIONS:
-d, --dir
ARGS:
json
{
"<input1>": "<output1>",
"<input2>": "<output2>",
"<...>": "<...>"
}
The output is necessary when using --sort
or --regex
options.
The accepted syntax of regex pattern is RE2.
{I:P}
where I
is the index of captured group and P
is the padding of digits with 0
. For example, {2:3}
means the third captured group with a padding of 3, i.e. 1
is formatted as 001
.0
, and {0}
means the filename.I
could be dropped, i.e. {}
or {:3}
. In this case an auto incremental index is used which starts from 1
. For example, {} {}
equals {1} {2}
.{
and }
characters could be escaped using \
character, i.e. \\{
and \\}
in cli.{:3}
for 1
is 001
, for -1
is -1
and for a
is a
.--sort
option is used, the first index {0}
is the filename and the second index {1}
or first occurrence of {}
is the enumerator index.Consider the following directory:
bash
➜ ls
Nomino (2020) S1.E1.1080p.mkv
Nomino (2020) S1.E2.1080p.mkv
Nomino (2020) S1.E3.1080p.mkv
Nomino (2020) S1.E4.1080p.mkv
Nomino (2020) S1.E5.1080p.mkv
Note that -p
flag is used to print the table and -e
flag is used to preserve the extension of input.
regex
option:bash
➜ nomino -pr ".* S(\d+).E(\d+).*.(mkv)" "S{:2}E{:2}.{}"
+-------------------------------+------------+
| Input | Output |
+-------------------------------+------------+
| Nomino (2020) S1.E1.1080p.mkv | S01E01.mkv |
| Nomino (2020) S1.E2.1080p.mkv | S01E02.mkv |
| Nomino (2020) S1.E3.1080p.mkv | S01E03.mkv |
| Nomino (2020) S1.E4.1080p.mkv | S01E04.mkv |
| Nomino (2020) S1.E5.1080p.mkv | S01E05.mkv |
+-------------------------------+------------+
sort
option:bash
➜ nomino -pes asc "{:3}"
+-------------------------------+---------+
| Input | Output |
+-------------------------------+---------+
| Nomino (2020) S1.E1.1080p.mkv | 001.mkv |
| Nomino (2020) S1.E2.1080p.mkv | 002.mkv |
| Nomino (2020) S1.E3.1080p.mkv | 003.mkv |
| Nomino (2020) S1.E4.1080p.mkv | 004.mkv |
| Nomino (2020) S1.E5.1080p.mkv | 005.mkv |
+-------------------------------+---------+
bash
➜ nomino -pes desc "{:3}"
+-------------------------------+----------+
| Input | Output |
+-------------------------------+----------+
| Nomino (2020) S1.E5.1080p.mkv | 001.mkv |
| Nomino (2020) S1.E4.1080p.mkv | 002.mkv |
| Nomino (2020) S1.E3.1080p.mkv | 003.mkv |
| Nomino (2020) S1.E2.1080p.mkv | 004.mkv |
| Nomino (2020) S1.E1.1080p.mkv | 005.mkv |
+-------------------------------+----------+
map.json
file:json
{
"Nomino (2020) S1.E1.1080p.mkv": "0101.mkv",
"Nomino (2020) S1.E2.1080p.mkv": "0102.mkv",
"Nomino (2020) S1.E3.1080p.mkv": "0103.mkv",
"Nomino (2020) S1.E4.1080p.mkv": "0104.mkv",
"Nomino (2020) S1.E5.1080p.mkv": "0105.mkv"
}
bash
➜ nomino -pm map.json
+-------------------------------+----------+
| Input | Output |
+-------------------------------+----------+
| Nomino (2020) S1.E1.1080p.mkv | 0101.mkv |
| Nomino (2020) S1.E2.1080p.mkv | 0102.mkv |
| Nomino (2020) S1.E3.1080p.mkv | 0103.mkv |
| Nomino (2020) S1.E4.1080p.mkv | 0104.mkv |
| Nomino (2020) S1.E5.1080p.mkv | 0105.mkv |
+-------------------------------+----------+
-g
option, then use that map file to undo renaming:```bash ➜ nomino -g undo.json -pr ".*.(mkv)" "a.{}" +-------------------------------+-----------+ | Input | Output | +-------------------------------+-----------+ | Nomino (2020) S1.E1.1080p.mkv | _a.mkv | | Nomino (2020) S1.E4.1080p.mkv | _a.mkv | | Nomino (2020) S1.E3.1080p.mkv | _a.mkv | | Nomino (2020) S1.E2.1080p.mkv | _a.mkv | | Nomino (2020) S1.E5.1080p.mkv | a.mkv | +-------------------------------+-----------+
➜ nomino -pm undo.json +-----------+-------------------------------+ | Input | Output | +-----------+-------------------------------+ | _a.mkv | Nomino (2020) S1.E1.1080p.mkv | | _a.mkv | Nomino (2020) S1.E2.1080p.mkv | | _a.mkv | Nomino (2020) S1.E3.1080p.mkv | | _a.mkv | Nomino (2020) S1.E4.1080p.mkv | | a.mkv | Nomino (2020) S1.E5.1080p.mkv | +-----------+-------------------------------+ ```
Please refer to wiki for benchmark results of similar tools.