This crate provides a simple command line utility for randomly selecting N files from a directory and copying or moving them to a target directory.
randselect
operates (inefficiently) by generating a random permutation of the
files in a given directory, then moving or copying the first N files in the
resulting permutation to a target directory.
Could you do this with a few lines of bash? Almost certainly! This was just an excuse to write some Rust.
You can install this with Cargo:
$ cargo install randselect
``` randselect Tool for randomly selecting files from a directory.
USAGE:
randselect [OPTIONS]
ARGS:
OPTIONS:
-g, --go Execute the copy or move. Specify a seed for deterministic
behavior
-h, --help Print help information
-m, --move-files Whether to move the files from INDIR to OUTDIR, rather than cp
-n, --num-files