Skip to content

Instantly share code, notes, and snippets.

@tclh123
Created October 5, 2025 05:30
Show Gist options
  • Select an option

  • Save tclh123/6014b08016d400138e643659a1c47cb8 to your computer and use it in GitHub Desktop.

Select an option

Save tclh123/6014b08016d400138e643659a1c47cb8 to your computer and use it in GitHub Desktop.
#!/bin/bash
dir=${1:-.}
dirs=`find $dir -not -path '*/.*' -not -path './venv' -type d -maxdepth 1`
for d in $dirs; do
cnt=`find $d -type f -exec wc -l {} + | awk '{s+=$1} END {print s}'`
echo -e "$cnt\t$d/"
done | sort -nr
files=`find $dir -not -path '*/.*' -type f -maxdepth 1`
for f in $files; do
cnt=`find $f -type f -exec wc -l {} + | awk '{s+=$1} END {print s}'`
echo -e "$cnt\t$f"
done | sort -nr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment