Below command recursively counts number of lines in current directory. It excludes certain directories such as ./target/, ./.idea/, etc. find . ! -path "./target/*" ! -path "./.mvn/*" ! -path "./.idea/*" -name "*" | xargs wc -l