Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # stop script on errors
- set -e
- PROG=sha256sum
- FILENAME=verify-tree
- if [[ -e "${FILENAME}.sha256" ]]; then
- mv "${FILENAME}.sha256" "${FILENAME}.$(date --reference=${FILENAME}.sha256 '+%Y%m%d-%H%M%S').sha256"
- fi
- echo ""
- echo "Output Filename: ${FILENAME}.sha256"
- echo "Files Found: $(find . -type f -not -name "${FILENAME}*.sha256" | wc -l)"
- echo "Size: $(du -chs . | grep 'total')"
- time find . -type f -not -name "${FILENAME}*.sha256" -exec ${PROG} "{}" \; >> "${FILENAME}.sha256"
- echo ""
- echo "Files Processed: $(wc -l ${FILENAME}.sha256)"
- echo ""
- echo "Checking..."
- time ${PROG} -c --quiet "${FILENAME}.sha256"
- echo ""
- echo "All files verified."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement