我想要统计项目目录中所有
它列出了许多
谢谢。
.class
文件的数量。我正在使用Ubuntu操作系统。我可以像这样列出所有的class文件 -find . -type f -name '*.class'
它列出了许多
.class
文件。但我想知道这些 .class
文件的数量。在 Linux 中有没有方法可以做到这一点。谢谢。
find . -type f -name '*.class' -exec echo 1
,或更有效率的方式,如果支持的话,使用find ... -printf "\1n"
)。 - chepnerprintf
还有更好的方法:如果使用GNUfind
,则可以使用find...-printf'x'
,然后计算字符数。对于不支持printf
的find
,请使用系统的printf
:find ... -exec printf '%.sx' {} +
然后同样地计算字符数。要计算字符数,可以使用xs = $(find...-printf x); echo“$ {# xs}”
。 - gniourf_gniourf