lrg
A utility to help find the largest file(s) in a directory
Requirements
Building the binary (only tested on macOS and linux)
# First clone the repo:
# cd into it:
# Build it:
# The binary will be in ./target/release/lrg
Examples
Check https://docs.rs/lrg/ for the full docs
Using the binary
To find the largest files in the current directory (by default, it searches the current directory, and only fetches the top 5):
To search another directory (such as the home directory):
To only search in the current directory and not recurse through others:
Full Usage
lrg 0.2.0
Noah Rinehart <rinehart.noah@gmail.com>
A utility to help find the largest file(s) in a directory
USAGE:
lrg [FLAGS] [OPTIONS] [FILEPATH]
FLAGS:
-b, --absolute outputs files' absolute path (default: false)
-a, --ascending sort the results in ascending order (default: false)
-i, --directories include directories in search (default: false)
-l, --follow-links will follow links of files (default: false)
-r, --no-recursion will only visit files in specified directory, takes precedence over max-depth (default: false)
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-d, --max-depth <MAX_DEPTH> sets the maximum depth of folders to search, unless --no-recursion specified
(default: max possible)
-n, --number <NUM_ENTRIES> sets the number of files to list (default: 5)
-u, --units <UNITS> sets the units to display: decimal for 1000KB, binary for 1024KiB, conventional for
1024KB (default: conventional)
ARGS:
<FILEPATH> the path to search in
Using the library
First, add the crate to your project (check for which version you would like to use, or just put * to use the latest):
# Cargo.toml
Then, add extern create lrg
at the top of your project.
To find the largest files in a directory:
use Path;
use ;
// Get a path to some directory (or file)
let path = new;
// Create the Lrg object to store the entries
let mut lrg: Lrg = new;
// Sort and get the entries
let mut entries: = lrg.sort_by.get_entries;
// You can also call `sort_descending`
entries = lrg.sort_descending.get_entries;
// These calls mutate the underlying struct, so calling:
entries = lrg.get_entries;
// Will give you the same as the call before it
To find the smallest files in a directory:
let path = new;
let mut lrg: Lrg = new;
let entries: = lrg.sort_ascending.get_entries;
To search using a custom function:
let path = new;
let mut lrg: Lrg = new;
// Sort by filename (note: not the full path)
lrg.sort_by_custom;
let entries: = lrg.get_entries;