Skip to content

A command-line utility to checksum directories and files.

License

Notifications You must be signed in to change notification settings

ultimateanu/hashdir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hashdir

build test codecov

sample terminal usage

A command-line utility to hash directories and files.

hashdir aims to be the easiest way to hash a file/directory. This is useful in many situations such as transferring files, archiving data, or detecting duplicates. It is a single binary, works on all major OS's, and has a simple command-line interface. It is developed with F# on .NET 8.

Links: Github, NuGet, Project Site

Installation

There are several ways to get hashdir. Full details can be found here.

  • Homebrew*: brew install ultimateanu/software/hashdir
  • dotnet: dotnet tool install --global hashdir
  • Scoop: scoop bucket add ultimateanu https://github.com/ultimateanu/homebrew-software; scoop install hashdir
  • Stand-alone binary: latest version for macOS, Windows, and Linux can be found at releases
  • AUR (Arch User Repository): If you are using an Arch-based distribution, you can build and install the hashdir package from the AUR

*Homebrew currently requires a project to have 50 stars to be included in core. So I’ve set up a custom tap for now that still allows easy installation. If you like this project, please consider starring on Github and adding a formula to Homebrew core eventually.

Usage

hashdir:
  A command-line utility to hash directories and files.

Usage:
  hashdir [options] [<item>...] [command]

Arguments:
  <item>    Directory or file to hash/check

Options:
  -t, --tree                                                   Print directory tree
  -s, --save                                                   Save the checksum to a file
  -i, --include-hidden-files                                   Include hidden files
  -e, --skip-empty-dir                                         Skip empty directories
  -n, --ignore <pattern>                                       Directories/files to not include
  -h, --hash-only                                              Print only the hash
  -a, --algorithm <md5|ripemd160|sha1|sha256|sha384|sha512>    The hash function to use [default: sha1]
  -c, --color                                                  Colorize the output [default: True]
  --version                                                    Show version information
  -?, -h, --help                                               Show help and usage information

Commands:
  check <item>    Verify that the specified hash file is valid.

Examples

  1. Hash a file/directory: hashdir ~/Desktop/project/
  2. Hash a directory with hidden files and print tree: hashdir --include-hidden-files --tree ~/Desktop/project
  3. Hash multiple items using MD5: hashdir -a md5 song.mp3 info.txt report.pdf
  4. Hash a directory, but ignore certain directories/files: hashdir --ignore "node_modules" --ignore "**/*.xml" ~/Desktop/project

License

MIT License

hashdir is an open-source project with a permissive license. If you find a bug or have suggestions feel free to create an issue on Github. Any contributions to the code, tests, or documentation are also welcome via a pull request.