#random #rename #filetool

app rng-rename

Rename files to randomly generated strings

12 releases (4 breaking)

Uses new Rust 2021

new 0.5.1 Jun 20, 2022
0.5.0 May 28, 2022
0.4.4 May 18, 2022
0.4.3 Feb 27, 2022
0.1.0 Feb 7, 2022

#57 in Filesystem

Download history 5/week @ 2022-03-03 1/week @ 2022-03-10 56/week @ 2022-03-17 1/week @ 2022-03-31 9/week @ 2022-04-07 1/week @ 2022-04-21 72/week @ 2022-04-28 65/week @ 2022-05-05 155/week @ 2022-05-12 54/week @ 2022-05-19 73/week @ 2022-05-26 102/week @ 2022-06-02 30/week @ 2022-06-16

215 downloads per month

AGPL-3.0-only

55KB
1.5K SLoC

rng-rename

A CLI tool to rename files to randomly generated strings.

Quick Start

# rename `path/to/foo` and `path/to/bar.txt` to randomly generated names
rng-rename path/to/foo path/to/bar.txt

The defaults are sensible, so you can expect something like this:

Batch #1/1:
        "/abs/path/to/foo" -> "09c43d3d"
        "/abs/path/to/bar.txt" -> "67aec57d.txt"
Confirm batch? You can proceed(p), skip(s), or halt(h): proceed
Renamed 2 files. Done.

Markdown doesn't show colours, but the real thing does!

rng-rename on Alacritty

There are plenty of various options available. You can for example:

  • Preview using the --dry-run flag
  • Choose which character set to use for random names using the --char-set option
  • Specify the number of random characters using the --length option
  • Choose upper/lower/mixed case where applicable using the --case option
  • Set a prefix and/or a suffix to the randomly generated name using --prefix and --suffix options
  • Choose what to do with the file extension using the --ext-mode option

And more. For full usage, run:

rng-rename --help

Why?

Suppose you downloaded a few hundred images to use as your desktop wallpapers. You have a wallpaper tool that cycles through them, but unfortunately it only supports filename-ordering, whereas you prefer to have the images shuffled.

Well, rng-rename to the rescue! Simply run this tool on all your images and the filename-ordering is completely scrambled.

You can also use this tool for data analysis purposes. A data scientist might want to randomise their dataset before running some analysis, but keep the same ordering over several runs. rng-rename is useful in this case too.

I guess you can say rng-rename is a tool looking for a purpose. Ultimately it is up to you, the user, to give it a one.

Install

from crates.io

rng-rename on crates.io

cargo install rng-rename

from AUR

rng-rename on AUR

# with paru
paru rng-rename

# or with yay
yay rng-rename

Contributing

All ideas and pull requests are welcomed! Please abide by Rust's official code of conduct.

For an incomplete list of things that could use improvement, please see Errata.md.

Dependencies

~5MB
~112K SLoC