David Wells

Full Stack Developer

Focused on UX/UI, Growth
& Product Development

Find all Javascript files in a project & count line numbers

Published on Edit this post

Find all javascript files in a project, excluding node_modules and output their line number length

Useful for seeing what files might need refactoring.

# javascript-line-length.sh
find ./ -type f -name "*.js" -not -path "*/node_modules/*" -print0 | xargs -0 wc -l | sort -n >> files.txt | echo 'Done. See files.txt for stats'