Counting Lines in Text Files
Let’s assume we have a directory of text files, and we need the grand total line count across all of the files.
My first attempt was this:
I expected this to not give me what I wanted. I expected it to show me line totals by file - but I was surprised to see a grand total line count at the end.
Then, I saw a variation on the above approach, in a Stack Overflow answer:
How to count all the lines of code in a directory recursively?
Simple and effective - just the grand total.