I would like to have a script that goes through every single file in a directory (that includes sub directories) and return me the total number of lines in all files excluding blank lines and excluding folders/files that have key words on them (log).
I currently have a line of code which returns me the total number of lines (including blank lines) in files of a single directory 'files'
cat /home/user/files/* | wc -l
Is there someway to implement so that I can call a code which can read through, for example:
- /home/user/files/*
- /home/user/files/files2/*
- /home/user/files/files2/files3/*
a bunch of directories (unknown number) and return me the total number of lines of all files (excluding blank lines) (and excluding folders/files that have key words on them (log)) found.
I'm currently using BASH to script but if there is an solution in python, I'm more than happy to use it.