rmv: Renaming made easy with regex
Go to file
Pedro de Oliveira bc1e2c8e9a Explain that Rust is needed.
Explain a bit better the `--pattern` argument.
2023-05-07 20:49:26 +01:00
src Remove uneeded part in example. 2023-05-07 20:40:39 +01:00
.gitignore First commit. WIP, just prints the mv command. Untested. 2023-05-07 20:01:12 +01:00
Cargo.lock First commit. WIP, just prints the mv command. Untested. 2023-05-07 20:01:12 +01:00
Cargo.toml Add README.md and LICENSE. 2023-05-07 20:18:13 +01:00
LICENSE Add README.md and LICENSE. 2023-05-07 20:18:13 +01:00
README.md Explain that Rust is needed. 2023-05-07 20:49:26 +01:00

README.md

rmv: Renaming made easy with regex

rmv is a command-line tool that allows you to rename files in a directory using regular expressions. You can use it to match patterns in filenames and replace them with new patterns.

Installation

To install rmv, Rust needs to be installed. Once Rust is installed, run the following command:

cargo install --git https://git.deadbsd.org/falso/rmv.git

Usage

To use rmv, you need to specify the path to the directory where the files to be renamed are located, a regular expression pattern to match against the filenames, and a replacement pattern for the matched filenames.

In the --replacement argument, you can use reference groups in the pattern by using \1, \2, etc. For example, if you have a pattern "Season (\d) Episode (\d)"that matches "Season 1 Episode 2" and you want to replace it with "S01E02", you can use the following replacement pattern: "S\1E\2".

Here is an example usage:

$ rmv --path /path/to/files --pattern "S(\d+)E(\d+).*\.(...)" --replacement "Season \1 Episode \2.\3" --wildcard "*.mkv"

This will match all filenames in the directory that match the pattern "S(\d+)E(\d+).*\.(...)" and replace them with the pattern "Season \1 Episode \2.\3". Only files with the ".mkv" extension will be considered.

mv "Not Warez - S01E16 - HDTV-720p.mkv" "Season 01 Episode 16.mkv"
mv "Not Warez - S01E17 - HDTV-720p.mkv" "Season 01 Episode 17.mkv"
mv "Not Warez - S01E18 - HDTV-720p.mkv" "Season 01 Episode 18.mkv"
mv "Not Warez - S01E19 - HDTV-720p.mkv" "Season 01 Episode 19.mkv"
mv "Not Warez - S01E20 - WEBDL-1080p.mkv" "Season 01 Episode 20.mkv"
mv "Not Warez - S01E21 - WEBDL-1080p.mkv" "Season 01 Episode 21.mkv"

Options

Here are the available options:

-i, --path <PATH>
    Path to the directory where the files to be renamed are located

-s, --pattern <PATTERN>
    Regular expression pattern to match against the filenames in the directory.
    The pattern should contain match groups (expressed in parentheses). Example: "S(\d+)E(\d+).*\.(...)"

-r, --replacement <REPLACEMENT>
    Replacement pattern for the matched filenames.
    You can use `\1`, `\2`, etc. to reference the match groups in the pattern. Example: "Season \1 Episode \2.\3"

-w, --wildcard <WILDCARD>
    Filename wildcard to filter the files to be renamed in the directory.
    For example, "*.mkv" will match all files with the ".mkv" extension.
    [default: *]

-h, --help
    Print help (see a summary with '-h')

-V, --version
    Print version

License

This tool is licensed under the WTFPL. See the LICENSE file for details.