问题:
We've got a PHP application and want to count all the lines of code under a specific directory and its subdirectories. 我们有一个PHP应用程序,并希望计算特定目录及其子目录下的所有代码行。 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... 我当时认为这可行,但它正在返回74,绝对不是这样......
find . -name '*.php' | wc -l
What's the correct syntax to feed in all the files? 提供所有文件的正确语法是什么?
解决方案:
参考一: https://stackoom.com/question/5hPw/如何递归计算目录中的所有代码行参考二: https://oldbug.net/q/5hPw/How-to-count-all-the-lines-of-code-in-a-directory-recursively
来源:oschina
链接:https://my.oschina.net/u/4438370/blog/4479431