Advertisement
Guest User

sha256sum-maketreecheckfile

a guest
Jun 23rd, 2015
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.69 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # stop script on errors
  4. set -e
  5.  
  6. PROG=sha256sum
  7. FILENAME=verify-tree
  8.  
  9. if [[ -e "${FILENAME}.sha256" ]]; then
  10.                 mv "${FILENAME}.sha256" "${FILENAME}.$(date --reference=${FILENAME}.sha256 '+%Y%m%d-%H%M%S').sha256"
  11. fi
  12.  
  13. echo ""
  14. echo "Output Filename: ${FILENAME}.sha256"
  15. echo "Files Found: $(find . -type f -not -name "${FILENAME}*.sha256" | wc -l)"
  16. echo "Size: $(du -chs . | grep 'total')"
  17. time find . -type f -not -name "${FILENAME}*.sha256" -exec ${PROG} "{}" \; >> "${FILENAME}.sha256"
  18. echo ""
  19. echo "Files Processed: $(wc -l ${FILENAME}.sha256)"
  20.  
  21. echo ""
  22. echo "Checking..."
  23. time ${PROG} -c --quiet "${FILENAME}.sha256"
  24. echo ""
  25. echo "All files verified."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement