Guest User

chksum-all-recursive.sh

a guest
Dec 4th, 2020
53
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env bash
  2.  
  3. set -euo pipefail
  4. set -x
  5.  
  6. F_MD5=$(mktemp)
  7. find -type f -exec md5sum "{}" + > "$F_MD5" &
  8.  
  9. F_SHA1=$(mktemp)
  10. find -type f -exec sha1sum "{}" + > "$F_SHA1" &
  11.  
  12. F_SHA224=$(mktemp)
  13. find -type f -exec sha224sum "{}" + > "$F_SHA224" &
  14.  
  15. F_SHA256=$(mktemp)
  16. find -type f -exec sha256sum "{}" + > "$F_SHA256" &
  17.  
  18. F_SHA384=$(mktemp)
  19. find -type f -exec sha384sum "{}" + > "$F_SHA384" &
  20.  
  21. F_SHA512=$(mktemp)
  22. find -type f -exec sha512sum "{}" + > "$F_SHA512" &
  23.  
  24. wait
  25.  
  26. grep -v CHECKSUM "$F_MD5" > CHECKSUM.MD5
  27. grep -v CHECKSUM "$F_SHA1" > CHECKSUM.SHA1
  28. grep -v CHECKSUM "$F_SHA224" > CHECKSUM.SHA224
  29. grep -v CHECKSUM "$F_SHA256" > CHECKSUM.SHA256
  30. grep -v CHECKSUM "$F_SHA384" > CHECKSUM.SHA384
  31. grep -v CHECKSUM "$F_SHA512" > CHECKSUM.SHA512
  32. rm -f "$F_MD5" "$F_SHA1" "$F_SHA224" "$F_SHA256" "$F_SHA384" "$F_SHA512"
  33.  
  34. exit 0
RAW Paste Data