Friday, July 19, 2019
bash - How to count all the lines of code in a directory recursively?
Answer
Answer
We've got a PHP application and want to count all the lines of code under a specific directory and its subdirectories. We don't need to ignore comments, as we're just trying to get a rough idea.
wc -l *.php
That command works great within a given directory, but ignores subdirectories. I was thinking this might work, but it is returning 74, which is definitely not the case...
find . -name '*.php' | wc -l
What's the correct syntax to feed in all the files?
Answer
Try:
find . -name '*.php' | xargs wc -l
The SLOCCount tool may help as well.
It'll give an accurate source lines of code count for whatever
hierarchy you point it at, as well as some additional stats.
Sorted output: find . -name '*.php' | xargs wc -l | sort -nr
plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV
In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...
-
When the left part is an object instance, you use -> . Otherwise, you use :: . This means that -> is mostly used to access instance m...
-
This question attempts to collect the few pearls among the dozens of bad C++ books that are published every year. Unlike many other programm...
-
I am new to dask and I found so nice to have a module that makes it easy to get parallelization. I am working on a project where I was able ...
No comments:
Post a Comment