#!/usr/bin/env sh target_dir="$1" if [ ! -d "$target_dir" ]; then echo "❌ Dir not found: $target_dir" return 1 fi total_lines=0 echo "📁 Analyze dir: $target_dir" for f in "$target_dir"/*; do [ -f "$f" ] || continue lines=$(wc -l <"$f") size=$(stat -c %s "$f") mod=$(date -d @"$(stat -c %Y "$f")" +"%Y-%m-%d %H:%M:%S") sha=$(shasum -a 256 "$f" | cut -d ' ' -f 1) total_lines=$((total_lines + lines)) printf "%-30s %10s bytes %5s lines %s SHA256: %s\n" "$(basename "$f")" "$size" "$lines" "$mod" "$sha" done echo "📊 Total lines of code in the dir: $total_lines"