Skip to content

Instantly share code, notes, and snippets.

@mordr
Created December 29, 2018 22:16
Show Gist options
  • Save mordr/fd9668068d6e18e8dda00b04e6a29731 to your computer and use it in GitHub Desktop.
Save mordr/fd9668068d6e18e8dda00b04e6a29731 to your computer and use it in GitHub Desktop.
Generate hash of directory
find . -type f -print0 | sort -z | xargs -0 shasum -a 256 | shasum -a 256 | awk '{print $1}'

For example, we have the following directory.

test/
├── a
└── b

To generate directory hash, change into directory and run the cmd.

$▶ cd test/
$▶ find . -type f -print0 | sort -z | xargs -0 shasum -a 256 | shasum -a 256 | awk '{print $1}'
9c5811e2d31262e0370d79c08d8e62bb5acbfeb19735103c220a037e8e369587
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment