mirror of
https://github.com/starr-dusT/dotfiles.git
synced 2025-02-18 18:57:32 -08:00
add tree script
This commit is contained in:
parent
822d68f093
commit
3818cb7cc4
22
home/bin/executable_linux-tree-dir
Normal file
22
home/bin/executable_linux-tree-dir
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Check if the directory is provided
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Usage: $0 <directory>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Function to print the tree with SHA256 sums
|
||||||
|
print_tree_with_sha256() {
|
||||||
|
local dir="$1"
|
||||||
|
|
||||||
|
# Use find to recursively list files, and calculate sha256sum for each file
|
||||||
|
find "$dir" -type f | while read -r file; do
|
||||||
|
sha256=$(sha256sum "$file" | awk '{print $1}')
|
||||||
|
echo "$file - $sha256"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Call the function with the provided directory
|
||||||
|
print_tree_with_sha256 "$1"
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user