Using the command:
wc -l + `find . -name \* -print`
You can get the total number of lines of all files inside a folder.
But imagine you have some folders (for example libraries), which you don’t want to count their lines because you didn’t write them.
So, how would you count the lines in a project excluding certain folders?
With
find, you can also “negate” matching conditions with!. For example, if I want to list all the.javafiles in a directory, excluding those containingTest:find . -name "*.java" ! -name "*Test*"Hope this helps!
Edit:
By the way, the
-namepredicate only filters file names. If you want to filter paths (so you can filter directories), use-path:find . -path "*.java" ! -path "*Test*"