Crates.io | nomino |
lib.rs | nomino |
version | |
source | src |
created_at | 2020-04-18 09:17:20.591866+00 |
updated_at | 2025-02-20 18:19:43.913941+00 |
description | Batch rename utility for developers |
homepage | https://github.com/yaa110/nomino |
repository | https://github.com/yaa110/nomino |
max_upload_size | |
id | 231439 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
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 need to run chmod +x nomino-linux-64bit
or chmod +x nomino-macos-64bit
.
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
Usage:
nomino [OPTIONS] [[SOURCE] OUTPUT]...
Arguments:
[[SOURCE] OUTPUT]...
OUTPUT is the pattern to be used for renaming files, and SOURCE is the optional regex pattern to match by filenames. SOURCE has the same function as -r option
Options:
-d, --dir <PATH> Sets the working directory
--depth <DEPTH> Optional value to overwrite inferred subdirectory depth value in 'regex' mode
-E, --no-extension Does not preserve the extension of input files in 'sort' and 'regex' options
-g, --generate <PATH> Stores a JSON map file in '<PATH>' after renaming files
-h, --help Print help (see a summary with '-h')
-k, --mkdir Recursively creates all parent directories of '<OUTPUT>' if they are missing
-m, --map <PATH> Sets the path of map file to be used for renaming files
--from-file <PATH> Alias for --map
--max-depth <DEPTH> Optional value to set the maximum of subdirectory depth value in 'regex' mode
-q, --quiet Does not print the map table to stdout
-r, --regex <PATTERN> Regex pattern to match by filenames
-s, --sort <ORDER> Sets the order of natural sorting (by name) to rename files using enumerator
Possible ORDER values:
- asc: Sort in ascending order
- desc: Sort in descending order
-t, --test Runs in test mode without renaming actual files
--dry-run Alias for --test
-V, --version Print version
-w, --overwrite Overwrites output files, otherwise, a '_' is prepended to filename
OUTPUT pattern accepts placeholders that have the format of '{G:P}' where 'G' is the captured group and 'P' is the padding of digits with `0`. Please refer to https://github.com/yaa110/nomino for more information.
{G:P}
where G
is the 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.G
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.The accepted syntax of regex pattern is Rust Regex.
Consider this example:
(?<first>\w)(\w)\w(?<last>\w)
This regular expression defines 4 capture groups:
0
corresponds to the overall match. It is always present in every match and never has a name: {0}
.1
with name first
corresponding to the first letter: {1}
, {first}
or the first occurrence of {}
.2
with no name corresponding to the second letter: {2}
or the second occurrence of {}
.3
with name last
corresponding to the fourth and last letter: {3}
, {last}
or the third occurrence of {}
.?<first>
and ?<last>
are named capture groups.
On Windows, \\
must be used to separate path components in file paths because \
is a special character in regular expressions.
{
"<input1>": "<output1>",
"<input2>": "<output2>",
"<...>": "<...>"
}