Skip to content

Instantly share code, notes, and snippets.

@arose13
Created December 12, 2024 18:53
Show Gist options
  • Save arose13/eacce4715ec65d2db3fe4df78293053b to your computer and use it in GitHub Desktop.
Save arose13/eacce4715ec65d2db3fe4df78293053b to your computer and use it in GitHub Desktop.
Count the number of lines in your python project
#!/bin/bash
# Find all .py files and count their lines, excluding .venv directory
find . -name "*.py" -type f -not -path "./.venv/*" -exec wc -l {} \; | {
total=0
while read -r lines file; do
echo "$lines lines in $file"
((total += lines))
done
echo "-------------------------"
echo "Total: $total lines"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment