-
Notifications
You must be signed in to change notification settings - Fork 20
Examples
Navid edited this page Apr 19, 2020
·
12 revisions
Consider the following directory:
➜ 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.
- Rename files using
regex
option:
➜ 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 |
+-------------------------------+------------+
- Rename files using
sort
option:
➜ 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 |
+-------------------------------+---------+
➜ 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 |
+-------------------------------+----------+
- Rename files using the following
map.json
file:
{
"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"
}
➜ 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 |
+-------------------------------+----------+
- Undo renaming files: rename files by creating a map file using
-g
option, then use that map file to undo renaming:
➜ 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 |
+-----------+-------------------------------+