Skip to content

Instantly share code, notes, and snippets.

@skratchdot
Created December 9, 2015 11:21
Show Gist options
  • Save skratchdot/8053931ee7f3e30dec9d to your computer and use it in GitHub Desktop.
Save skratchdot/8053931ee7f3e30dec9d to your computer and use it in GitHub Desktop.
Get the shasum hash of an entire directory (recursively)
#!/bin/sh
find ./src -type f -print0 | sort -z | xargs -0 shasum | shasum
@gregl83
Copy link

gregl83 commented Jun 29, 2023

@skratchdot np, maybe it's helpful for another person!

There are trade-offs. The original solution should work on nix systems without requiring additional packages.

You might consider explicitly using SHA256 in your shasum invocations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment