Friday 19 July 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
php - file_get_contents shows unexpected output while reading a file
I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...
-
I have an app which needs a login and a registration with SQLite. I have the database and a user can login and register. But i would like th...
-
I would like to use enhanced REP MOVSB (ERMSB) to get a high bandwidth for a custom memcpy . ERMSB was introduced with the Ivy Bridge micro...
-
According to my understanding, and my calculator, cos(90 degrees) equals 0 . In my code, I have a funct...
No comments:
Post a Comment