Mention that currently only works in preview-mode.
Change the part about the tags. Removed the --help output. Prettify the --replacement part. Mention --wildcard in the arguments in [ ] so its optional.
This commit is contained in:
parent
5571e38898
commit
184ff2b8f7
60
README.md
60
README.md
|
@ -1,10 +1,17 @@
|
|||
# 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 file names and replace them with new patterns.
|
||||
`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 file names and replace them with new patterns.
|
||||
|
||||
## NOTE
|
||||
|
||||
Please note that `rmv` currently operates in **preview mode**, which means it will only display the command that should be executed to rename files using the specified regular expression patterns.
|
||||
**This preview mode does not actually rename any files, so you will need to manually execute the generated commands to perform the desired renames**.
|
||||
|
||||
## Installation
|
||||
|
||||
To install `rmv`, [Rust](https://www.rust-lang.org/) needs to be installed. Once Rust is installed, run the following command:
|
||||
To install `rmv`, [Rust](https://www.rust-lang.org/) needs to be installed.
|
||||
Once Rust is installed, run the following command:
|
||||
|
||||
```sh
|
||||
cargo install --git https://git.deadbsd.org/falso/rmv.git
|
||||
|
@ -14,29 +21,30 @@ cargo install --git https://git.deadbsd.org/falso/rmv.git
|
|||
|
||||
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 file names, and a replacement pattern for the matched file names.
|
||||
|
||||
`rmv --path <PATH> --pattern <PATTERN> --replacement <REPLACEMENT>`
|
||||
`rmv --path <PATH> --pattern <PATTERN> --replacement <REPLACEMENT> [--wildcard <WILDCARD>]`
|
||||
|
||||
### `--path`
|
||||
|
||||
The `--path` argument specifies the path to the directory where the files to be renamed are located. This argument is required.
|
||||
The `--path` argument specifies the path to the directory where the files to be renamed are located. **This argument is required**.
|
||||
|
||||
### `--pattern`
|
||||
|
||||
The `--pattern` argument specifies the regular expression pattern to match against the file names. This argument is required.
|
||||
The `--pattern` argument specifies the regular expression pattern to match against the file names. **This argument is required**.
|
||||
|
||||
You can use matching groups in the pattern to capture parts of the file name that you want to use in the replacement pattern. For example, the pattern `"S(\d+)E(\d+)"` will match on `"S01E23"` and capture `"01"` in group 1 and `"23"` in group 2.
|
||||
|
||||
### `--replacement`
|
||||
|
||||
The `--replacement` argument specifies the replacement pattern for the matched file names. This argument is required.
|
||||
The `--replacement` argument specifies the replacement pattern for the matched file names. **This argument is required**.
|
||||
|
||||
You can use reference groups in the pattern by using `{1}`, `{2}`, etc. to refer to the captured groups in the `--pattern` argument. For example, if you have a pattern `"S(\d+)E(\d+)"` that matches `"S01E11"` and you want to replace it with `"Season 01 Episode 11"`, you can use the following replacement pattern: `"Season {1} Episode {2}"`.
|
||||
|
||||
You can also use the following special tags in the replacement pattern:
|
||||
You can use the following tags in the replacement pattern:
|
||||
|
||||
* `{full_name}` - file name with extension
|
||||
* `{name}` - file name without extension
|
||||
* `{ext}` - extension
|
||||
* `{1}`, `{2}`, etc. to reference the match groups in the search pattern.
|
||||
|
||||
For example, if you have a pattern `"S(\d+)E(\d+)"` that matches `"S01E11"` and you want to replace it with `"Season 01 Episode 11"`, you can use the following replacement pattern: `"Season {1} Episode {2}.{ext}"`.
|
||||
|
||||
### `--wildcard` (optional)
|
||||
|
||||
|
@ -61,39 +69,5 @@ 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:
|
||||
|
||||
```sh
|
||||
-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 file names 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 file names.
|
||||
You can use `{1}`, `{2}`, etc. to reference the match groups in the pattern.
|
||||
There are also the following tags available:
|
||||
* {full_name} - file name with extension
|
||||
* {name} - file name without extension
|
||||
* {ext} - extension
|
||||
Example: "Season {1} Episode {2}.{ext}"
|
||||
|
||||
-w, --wildcard <WILDCARD>
|
||||
File name 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](LICENSE) file for details.
|
Loading…
Reference in New Issue