目录中所有文件中的行数

Shi*_*iji 0 windows cobol

我有一个包含许多源代码文件的文件夹.

我想在目录中的所有文件中找到源代码行的总数.

有没有简单的方法来做到这一点?

这些是cobol文件,我没有开放它们的开发工具,所以我不能只运行代码指标.

Pau*_*l R 6

假设您在Windows下使用*nix,Mac OS X甚至cygwin:

$ wc -l *
Run Code Online (Sandbox Code Playgroud)

如果你想包含子目录,那么你可以这样做:

$ find . -type f -print0 | xargs -0 wc -l
Run Code Online (Sandbox Code Playgroud)

如果您只想要总计(即跳过每个文件的所有单独行数),然后管道tail,例如

$ find . -type f -print0 | xargs -0 wc -l | tail -1
Run Code Online (Sandbox Code Playgroud)