Recursively Counting Lines of Code for An Entire Project Folder
Posted by Tres Wed, 09 Apr 2008 20:50:00 GMT
Here’s a little bash shell foo to figure out how many lines of code are in a specific directory and all its subdirectories.
As written, it looks for java files and excludes blank lines as well as subversion management directories:
totalcount=0 for i in `find . -name "*.java" -print | grep -v ".svn"` do newcount=`cat $i | grep -v "^$" | wc -l` totalcount=$(($totalcount+$newcount)) done echo "totalcount: $totalcount"