用PowerShell来计算代码的大小和行数
2010-10-25 12:10
381 查看
这里是两段脚本来计算代码的大小和行数。
代码大小(MB):
(Get-ChildItem . -Recurse | Where-Object {(!$_.PSIsContainer) -And ($_.FullName -Match '\.(h|m|cpp|c|cs|y)$')} | Measure-Object -Property Length -Sum).Sum / 1MB
代码行数:
Get-ChildItem . -Recurse | Where-Object {(!$_.PSIsContainer) -And ($_.FullName –Match '\.(h|m|cpp|c|cs|y)$')} | ForEach-Object {$l = 0} {$l += (Get-Content $_.PSPath).Count} {$l}
代码大小(MB):
(Get-ChildItem . -Recurse | Where-Object {(!$_.PSIsContainer) -And ($_.FullName -Match '\.(h|m|cpp|c|cs|y)$')} | Measure-Object -Property Length -Sum).Sum / 1MB
代码行数:
Get-ChildItem . -Recurse | Where-Object {(!$_.PSIsContainer) -And ($_.FullName –Match '\.(h|m|cpp|c|cs|y)$')} | ForEach-Object {$l = 0} {$l += (Get-Content $_.PSPath).Count} {$l}
相关文章推荐
- 关于android清除缓存代码及计算大小
- [原创]Python小工具 —— 计算 文件 或 文件夹及其所有子文件夹中所有文件 的 代码行数
- 获取项目中代码行数、图片资源列表及大小
- Python计算一个项目中含有的代码行数
- 计算一个目录下代码行数
- 计算一个项目工程中所有包下面的代码行数
- 用js实现计算代码行数的简单方法附代码
- vs计算代码行数
- 精确计算TFS中新增以及更改的代码行数
- 黑马程序员——OCFoundation框架-9:计算某个文件夹下的代码行数
- vs计算代码行数
- 《Objective-c》Foundation框架 -(练习:计算整个文件夹的代码行数)
- (转)python 计算代码行数以及相关知识点
- 计算程序行数的shell代码
- C#计算代码行数
- 一行代码比较用户A和用户B的年龄大小(两个日期计算)
- 计算编写代码行数
- 第十七篇:计算代码行数练习代码
- linux系统-代码行数计算
- C#代码行数的计算工具(递归的实现)