Last active
January 27, 2023 14:30
-
-
Save ismet55555/3b35df54dacf26f91708dfc1499b8652 to your computer and use it in GitHub Desktop.
Get a shortened hash of a directory that has been zipped up
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DIRECTORY_PATH="some/path/dir" | |
LENGTH=10 | |
zip --quiet --recurse-paths TEMP.zip \ | |
${DIRECTORY_PATH} \ | |
--exclude "**/<SOME SUB DIR>/*" "**/*.<SOME FILE EXTENSION>" | |
shasum -a 256 TEMP.zip \ | |
| awk '{ print $1 }' \ | |
| tail --bytes ${LENGTH) | |
rm -f TEMP.zip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment