tree node_modules/ | wc -l
I Peeked Into My Node_Modules Directory And You Won’t Believe What Happened Next
Jordan Scales
5.3K542
tree node_modules/ | wc -l
This also counts files, the summary line and as well empty lines, not only folders inside node_modules, as I think you intended to.
You could just `ls node_modules | wc -l`or, if you also want node_modules inside node_modules, something like this:
find . -name ‘node_modules’ -type d | while read -r mods; do ls $mods/ | wc -l; done | awk ‘{s+=$1} END {print s}’