Batch rename utility for developers

Overview

nomino

Test Download Wiki

Batch rename utility for developers

Alt text

How to install

Pre-Compiled

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.

Arch Linux

You can use nominoAUR package 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.

Build Manually

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:

  • Install Rust: curl -sSf https://sh.rustup.rs | sh
  • Run cargo install nomino

Usage

USAGE:
    nomino [FLAGS] [OPTIONS] [OUTPUT]

FLAGS:
    -e, --extension    Preserves the extension of input files in 'sort' and 'regex' options
    -h, --help         Prints help information
    -k, --mkdir        Recursively creates all parent directories of '<OUTPUT>' if they are missing
    -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 <PATH>         Sets the working directory
    -g, --generate <PATH>    Stores a JSON map file in '<PATH>' after renaming files
    -m, --map <PATH>         Sets the path of map file to be used for renaming files
    -r, --regex <PATTERN>    Regex pattern (RE2 syntax) to match by filenames
    -s, --sort <ORDER>       Sets the order of natural sorting (by name) to rename files using enumerator [possible values: ASC, DESC]

ARGS:
    <OUTPUT>    Output pattern to be used for renaming files

Map file format

{
    "<input1>": "<output1>",
    "<input2>": "<output2>",
    "<...>": "<...>"
}

Output

The output is necessary when using --sort or --regex options.

Regex

The accepted syntax of regex pattern is RE2.

Placeholders

  1. Placeholders have the format of {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.
  2. Indices start from 0, and {0} means the filename.
  3. The index 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}.
  4. { and } characters could be escaped using \ character, i.e. \\{ and \\} in cli.
  5. Padding is only used for positive numbers, e.g. the formatted result of {:3} for 1 is 001, for -1 is -1 and for a is a.
  6. If --sort option is used, the first index {0} is the filename and the second index {1} or first occurrence of {} is the enumerator index.

Wiki

  • Examples learn nomino by examples
  • Benchmark benchmark test of similar utilities to nomino
Comments
  • Failing to pass validity check on Arch Linux

    Failing to pass validity check on Arch Linux

    When I'm trying to install the latest version: 0.4.2, I'm getting this error in Arch Linux:

    ==> ERROR: One or more files did not pass the validity check!

    opened by CSRaghunandan 4
  • Add support for subdirectories

    Add support for subdirectories

    First, thanks for the work you've put into this project. I find it really handy. ;)

    Is your feature request related to a problem? Please describe. I think your project could benefit from letting the user also recurse into subdirectories

    For, instance, one could replace a whole subtree-structure as follows:

    ➜ nomino -p -r "(.*)/(.*)/(.*)" "{} {}.{}"
    

    Could restore your default structure

    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
    

    from, let's say a structure like this:

    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
    

    Describe the solution you'd like I would recommend that recursion is disabled by default, however, if a / is used, it is turned on automatically. Recursion depth should be an option in the cli as well.

    Additional context

    Best, da-h

    enhancement 
    opened by da-h 4
  • Check in Cargo.lock

    Check in Cargo.lock

    If Cargo.lock is checked into git, it eases the creation of packages, for example, in https://github.com/NixOS/nixpkgs. Please consider checking it in. See https://doc.rust-lang.org/cargo/faq.html#why-do-binaries-have-cargolock-in-version-control-but-not-libraries

    opened by Br1ght0ne 3
  • Unwelcomed `_` when zero-padding filenames

    Unwelcomed `_` when zero-padding filenames

    Hey Navid, let me start by expressing my gratitude for your efforts into this nice project !

    A frequent use case of mine is to rename a set of numbered files / directories by padding them with zeroes, and Nomino seems best suited for this.

    Unfortunately, it insists in renaming some paths when there's no need to.

    Take the following example:

    d="$(mktemp -d)"
    mkdir -p "$d/{1,5,10} - Whatever"
    nomino --dir "$d" --print --test '(\d+)(.*)' '{:2}{}'
    rmdir "$d"/* ; rmdir "$d"
    

    which outputs

    +---------------+----------------+
    | Input         | Output         |
    +---------------+----------------+
    | 1 - Whatever  | 01 - Whatever  |
    | 5 - Whatever  | 05 - Whatever  |
    | 10 - Whatever | _10 - Whatever |
    +---------------+----------------+
    

    whereas I'd expect to get

    +---------------+----------------+
    | Input         | Output         |
    +---------------+----------------+
    | 1 - Whatever  | 01 - Whatever  |
    | 5 - Whatever  | 05 - Whatever  |
    | 10 - Whatever | 10 - Whatever |
    +---------------+----------------+
    

    Could you please consider solving this ?

    Cheers, and best wished for this end of year !

    bug 
    opened by ngirard 2
  • Allow manually specifying search depth

    Allow manually specifying search depth

    Is your feature request related to a problem? Please describe. ([^/]*)/.* would search one more depth than I expect.

    https://github.com/yaa110/nomino/blob/88ca0f6275286b2ea9695121dcf172b55ecbc6de/src/input/source.rs#L23-L24

    Describe the solution you'd like Add a --max-depth and/or --depth option to control search depth of subdirectories.

    bug enhancement 
    opened by l2dy 2
  • AUR packaging dependency

    AUR packaging dependency

    Describe the bug

    According to Rust package guidelines, Rust packages on the AUR should declare makedepends=('cargo') instead of makedepends=('rust'). This allows rustup's installed toolchains to be picked up and makes the makepkg -dsi workaround unnecessary.

    I saw that you maintain the AUR package yourself so I thought I'd report the issue here.

    opened by cyqsimon 1
  • Missing error messages

    Missing error messages

    Describe the bug When not having write permissions to files, nomino fails silently

    Command

    ➜ nomino -er "(\d).(.*)" "{}-{}"
    

    Expected An error message that it could not do what it tried to do. (Running the same command with sudo (obviously) worked)

    Command map file (create using -g option)

    {
    doesnt matter
    }
    

    Expected map file

    {
    tables print fine as expected
    }
    

    Version (nomino -V) nomino 0.4.3

    Environment

    • OS: FreeBSD 12.1-RELEASE-p10 GENERIC amd64
    bug enhancement 
    opened by abjorck 1
  • More nests and recursion

    More nests and recursion

    Describe the bug Given the following nested hierarchy:

    start_dir
    ├── a
    ├── b
    ├── c
    │   ├── cc1
    │   └── cc2
    └── u
        ├── uu1
        └── uu2
    
    

    nomino's recursion goes only 1 level deep.

    Command

    ➜  nomino -tpkr ".*/(.*)/(.*)" "start_{}_{}"
    

    This should create start_c_cc1,start_c_cc2,start_u_uu1,start_u_uu2 Instead, nomino stops looking at items located in c and u folders.

    Version (nomino -V) nomino 0.3.1

    Environment

    • OS: Linux 5.6.4
    opened by Matelasse 1
  • Consider cross-platform support\builds

    Consider cross-platform support\builds

    You should consider making this a cross-platform tool (which should be fairly easy to accomplish being in go).

    Having builds available for Windows and Mac would expand the potential user base a great deal.

    enhancement 
    opened by brennanfee 1
  • \d not works on Windows

    \d not works on Windows

    nomino 1.2.2 on Windows 10 21h2 x64
    files in the current dir:
    1.txt 2.txt ... 10.txt
    nomino -tp "(\d+).txt" "{:2}.txt" (not work)
    nomino -tp "([0-9]+).txt" "{:2}.txt" (works)

    opened by jack6th 0
  • Add a flag to select the printed format

    Add a flag to select the printed format

    Is your feature request related to a problem? Please describe.

    I loved nomino pragmatic approach to renaming files.

    But I missing:

    • Printing output column aligned without table borders/headers/formating
    • Printing to markdown
    • Printing generated json to stdout

    Describe the solution you'd like

    Add some command-line options like:

    USAGE:
        nomino [FLAGS] [OPTIONS] [[SOURCE] OUTPUT]...
    
    FLAGS:
        -e, --extension    Preserves the extension of input files in 'sort' and 'regex' options
        -h, --help         Prints help information
        -k, --mkdir        Recursively creates all parent directories of '<OUTPUT>' if they are missing
        -w, --overwrite    Overwrites output files, otherwise, a '_' is prepended to filename
    -    -p, --print        Prints the rename map as table to stdout
    +    -p, --print        Prints the rename map as table to stdout
    +    -l, --log          Prints the rename map as table to stderr
        -t, --test         Runs in test mode without renaming actual files (dry-run)
        -V, --version      Prints version information
    
    OPTIONS:
            --depth <DEPTH>        Optional value to overwrite inferred subdirectory depth value in 'regex' mode
        -d, --dir <PATH>           Sets the working directory
        -g, --generate <PATH>      Stores a JSON map file in '<PATH>' after renaming files
    +    -G, --gen-as [FMT]         Change stored file format to <FMT> [possible values: cols, csv, json, markdown, table]
    +    -F, --format [FMT]         Change printed format to <FMT> [possible values: cols, csv, json, markdown, table]
        -m, --map <PATH>           Sets the path of map file to be used for renaming files
            --max-depth <DEPTH>    Optional value to set the maximum of subdirectory depth value in 'regex' mode
        -r, --regex <PATTERN>      Regex pattern (RE2 syntax) to match by filenames
        -s, --sort <ORDER>         Sets the order of natural sorting (by name) to rename files using enumerator [possible
                                   values: ASC, DESC]
    

    So command invocations like the bellow will print:

    $ ls -l *.md
    -rw-r--r--  1 root  root   4707 Jun 18 11:38 CODE_OF_CONDUCT.md
    -rw-r--r--  1 root  root  10429 Jun 18 11:38 CONTRIBUTING.md
    -rw-r--r--  1 root  root   4955 Jun 18 11:38 README.md
    $$ nomino -pt -F cols '(.*)\.(md)' '{2}-{1}+{}'
    CODE_OF_CONDUCT.md md-CODE_OF_CONDUCT+CODE_OF_CONDUCT
    CONTRIBUTING.md    md-CONTRIBUTING+CONTRIBUTING      
    README.md          md-README+README                  
    
    enhancement 
    opened by juarezr 0
  • Add support for creating links/symlinks insted of renaming

    Add support for creating links/symlinks insted of renaming

    Is your feature request related to a problem? Please describe. I'm downloading torrents and I want them to keep seeding but at the same time I want to have correctly named files

    Describe the solution you'd like I would like to have a flag like -s or -h to create symlinks or to create links similar to what the rename utility has

    enhancement 
    opened by asm0dey 0
Releases(1.3.1)
Owner
Navid
Navid
Sol Batch Token Transfer CSV

Sol Batch Token Transfer CSV This script can batch transfer any SPL token to multiple addresses listed in a CSV, and then save the tx hash to a new CS

The Z Institute 10 Nov 6, 2022
A simple web-app allowing you to batch archive groups of repositories from a given organization

ice-repos My goal here is to build a simple web-app allowing you to batch archive groups of repositories from a given organization, using Rust+Yew. As

Nic McPhee 6 Nov 5, 2022
A small utility for tracking the change in opening and closing of issues in a GitHub repo

A small utility for tracking the change in opening and closing of issues in a GitHub repo. This tool can be used to build visualizations for issue triage over time with the hope of motivating closing more issues than are opened.

Ryan Levick 12 Sep 29, 2021
mdTranslation is a utility to prepare multi-lingual Markdown documents.

mdTranslation is a utility to prepare multi-lingual Markdown documents. There's also a mdBook preprocessor called mdbook-translation for

Charles Lew 15 Dec 26, 2022
ᎩᎦᎨᎢ (IPA: [gigagei]) is a random quote fetching console utility. Written in Rust.

gigagei ᎩᎦᎨᎢ (IPA: [gigagei]) is a random quote fetching console utility. Written in Rust. Installing Use latest pre-built binary from releases Buildi

veleth 10 Jun 17, 2022
Utility library to work with tuples.

Utility library to work with tuples.

René Kijewski 9 Nov 30, 2022
A fast, multi-threaded line counting utility written in Rust.

xloc A fast, multi-threaded line counting utility written in Rust. What is xloc A drop in replacement for bash's wc -l. Your project has x lines of co

null 1 Nov 15, 2021
Provides utility functions to perform a graceful shutdown on an tokio-rs based service

tokio-graceful-shutdown IMPORTANT: This crate is in an early stage and not ready for production. This crate provides utility functions to perform a gr

null 61 Jan 8, 2023
A cli utility written in Rust that allows fetching all the labels of a project, save those as a YAML file

A cli utility written in Rust that allows fetching all the labels of a project, save those as a YAML file that you can easily edit or save as backup and apply a saved preset to new repositories.

Chevdor 4 May 5, 2022
Progmem utility for the AVR architecture

avr-progmem Progmem utilities for the AVR architectures. This crate provides unsafe utilities for working with data stored in the program memory of an

null 15 Nov 20, 2022
Emoji-printer - Utility to convert strings with emoji shortcodes to strings with the emoji unicode

Emoji Printer Intro Utility to convert strings with emoji shortcodes (:sushi:) to strings with the emoji unicode ( ?? ) Install cargo add emoji-printe

Kyle Scully 2 Dec 30, 2021
Rs.aws-login - A command line utility to simplify logging into AWS services.

aws-login A command line utility to simplify logging into AWS accounts and services. $ aws-login use ? Please select a profile to use: › ❯ dev-read

Kevin Herrera 11 Oct 30, 2022
A rust-based version of the popular dnsgen python utility

ripgen A rust-based version of the popular dnsgen python utility. ripgen is split into two main parts: ripgen: A CLI utility that calls into ripgen_li

resync 198 Jan 2, 2023
Tons of extension utility functions for Rust

LazyExt Tons of extension utility functions for Rust. English | 简体中文 Status Name Status Crate Documents Introduction lazyext-slice Alpha Thousands of

Al Liu 2 Dec 5, 2022
Lupus is a utility to administer backups with future integration with rsync

Lupus is a utility to administer backups with future integration with rsync. Many other features are either included or planned such as chat bridges using rcon and or parsing the pipe output from programs/games.

null 3 Sep 19, 2022
Auto Fan Management Utility in Linux Systems for Monster Laptops

Auto Fan Management Utility in Linux Systems for Monster Laptops Monster Laptoplar için Linux Sistemlerde Oto Fan Yönetimi TR Monster laptoplar gömülü

null 2 Aug 22, 2022
Small utility to display hour in a binary format on the Novation's Launchpad X.

lpx-binary-clock Small utility to display hour in a binary format on the Novation's Launchpad X. Hours, minutes and seconds are displayed one digit pe

Alexis LOUIS 1 Feb 13, 2022
Cakecutter - a utility tool that quickly sets up a project from a pre-built template

Cakecutter Create projects from pre-built cakes (templates)! Supports files, packages, content, running commands and more! Cakecutter is a utility too

Dhravya Shah 10 Jun 22, 2022
A decoder and utility for the Flipnote Studios .ppm animation format

A decoder and utility for the Flipnote Studios .ppm animation format

Usugata 11 Dec 12, 2022