A directory differential tool.
Go to file
Jon Moroney 3e49650335
Merge pull request #20 from bernaferrari/patch-1
add syntax highlighting in README
2020-03-17 09:11:06 -07:00
.github/workflows Add some public docs and examples. Bump version so that they show up on docs.rs/ddh 2020-02-18 10:28:03 -08:00
src Make deduplicate_dirs generic 2020-02-21 18:16:16 +01:00
.gitignore Ignore macos .DS_Store file 2018-11-16 11:15:11 -08:00
.travis.yml nix deploy 2018-07-02 11:03:00 -10:00
appveyor.yml Update tag for windows builds 2018-05-15 14:11:43 -10:00
Cargo.toml Bump version for new api signature 2020-02-22 17:36:34 -08:00
LICENSE Add license 2018-02-21 15:01:31 +01:00
README.md add syntax highlighting in README 2020-03-16 22:31:04 -03:00

Linux Build Status

Build Status

Windows Build Status

Build status

The Directory Differential hTool

DDH traverses input directories and their subdirectories. It also hashes files as needed and reports findings.

The H in "hTool" is silent. The H in its abbreviation, "DDH," is not.

This tool is called DDH for two very good reasons.

  • DDT is a dangerous pesticide
  • I mistyped when I created the project

Usage

DDH is usable both as a library and as a stand alone CLI tool and aims to be simple to use in both cases.

Library example

let (files, errors): (Vec<Fileinfo>, Vec<(_, _)>) = ddh::deduplicate_dirs(dirs);
let (shared, unique): (Vec<&Fileinfo>, Vec<&Fileinfo>) = files
                    .par_iter()
                    .partition(|&x| x.get_paths().len()>1);
process_full_output(&shared, &unique, &files, &errors, &arguments);

CLI Install

  • Install Rust
  • cargo install --git https://github.com/darakian/ddh ddh
  • The DDH binary will be installed into $CARGO_HOME/.bin/ddh, which usually is $HOME/.cargo/bin/ddh. This should be in your PATH already if you're using rustup.

CLI Features

DDH supports both a standard output for human comprehension and a parsable json output for custom tools such as ddh-move.

CLI Example

Directory Difference hTool
Jon Moroney jmoroney@hawaii.edu
Compare and contrast directories.
Example invocation: ddh /home/jon/downloads /home/jon/documents -f duplicates
Example pipe: ddh ~/Downloads/ -o no -v all -f json | someJsonParser.bin

USAGE:
    ddh [OPTIONS] <Directories>...

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -b, --blocksize <Blocksize>    Sets the display blocksize to Bytes, Kilobytes, Megabytes or Gigabytes. Default is
                                   Kilobytes. [possible values: B, K, M, G]
    -f, --format <Format>          Sets output format. [possible values: standard, json, off]
    -o, --output <Output>          Sets file to save all output. Use 'no' for no file output.
    -v, --verbosity <Verbosity>    Sets verbosity for printed output. [possible values: quiet, duplicates, all]

ARGS:
    <Directories>...    Directories to parse

How Does DDH Work?

DDH works by hashing files to determine their uniqueness and, as such, depends heavily on disk speeds for performance. The algorithmic choices in use are discussed here.