mirror of
https://github.com/starr-dusT/dotfiles.git
synced 2025-02-18 10:47:31 -08:00
use md5sum to verify file integrity
This commit is contained in:
parent
b89f92bb88
commit
21f92fbb59
@ -7,16 +7,16 @@ if [ -z "$1" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Function to print the tree with SHA256 sums
|
# Function to print the tree with SHA256 sums
|
||||||
print_tree_with_sha256() {
|
print_tree_with_md5() {
|
||||||
local dir="$1"
|
local dir="$1"
|
||||||
|
|
||||||
# Use find to recursively list files, and calculate sha256sum for each file
|
# Use find to recursively list files, and calculate md5sum for each file
|
||||||
find "$dir" -type f | while read -r file; do
|
find "$dir" -type f | while read -r file; do
|
||||||
sha256=$(sha256sum "$file" | awk '{print $1}')
|
md5=$(md5sum "$file" | awk '{print $1}')
|
||||||
echo "$file - $sha256"
|
echo "$file - $md5"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Call the function with the provided directory
|
# Call the function with the provided directory
|
||||||
print_tree_with_sha256 "$1"
|
print_tree_with_md5 "$1"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user