如何计算在递归目录中的code的所有行? [英] How to count all the lines of code in a directory recursively?

查看:110
本文介绍了如何计算在递归目录中的code的所有行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经有了一个PHP应用程序,并要算一个特定的目录及其子目录下的code的所有行。我们并不需要忽略的意见,因为我们只是想获得一个粗略的想法。

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

这是命令指定目录中的伟大工程,但忽略子目录。我想这可能工作,但它返回74,这绝对不是这样...

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?

推荐答案

尝试:

find . -name '*.php' | xargs wc -l

的SLOCCount工具 会有所帮助。

The SLOCCount tool may help as well.

这会给code计数的准确源线什么
尊卑你点一下,还有一些附加的统计信息。

It'll give an accurate source lines of code count for whatever hierarchy you point it at, as well as some additional stats.

这篇关于如何计算在递归目录中的code的所有行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆