Skip to content

Instantly share code, notes, and snippets.

@gzfrancisco
Last active August 29, 2015 14:01
Show Gist options
  • Save gzfrancisco/127d9f6010e74a025448 to your computer and use it in GitHub Desktop.
Save gzfrancisco/127d9f6010e74a025448 to your computer and use it in GitHub Desktop.
Script to get the hash of a folder.

Hash a entire folder

Script in bash which obtains get hash values of entire folders.

ToDo's

  • Man page
  • Usage
  • Take the arguments for:
    • Folder to hash
    • File where save the hash value
  • Remove temporaly files at the end

License

MIT

Author

Francisco Granados gzfrancisco.name @gzfrancisco

#! /usr/bin/env bash
find ./folder -type f > ./files_only.txt
IFS=$'\n' read -d '' -r -a lines < ./files_only.txt
for (( i=0; i < ${#lines[@]}; i++))
do openssl sha -sha384 "${lines[$i]}" >> hash_files_only.txt
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment