|
|
发表于 2013-12-29 07:55:14
|
显示全部楼层
powershell版中的群
http://www.bathome.net/thread-26048-1-1.html- #du 1.1- report directory disk usage
- Write-Host DU 1.1 - 统计目录大小的脚本,作用和linux的du类似。`n
- # pwershell交流群出品
- # 群号=183173532
- if (!$args)
- {write-host "du 绝对目录名,如:`ndu.ps1 d:\mp3"}
- else
- {
- if (!(Test-Path $args))
- {write-host "错误:找不到目标目录名!"}
- else
- {
- # 2010-8-15日出炉
- $a=Get-ChildItem $args | Where-Object {$_.PsIsContainer -eq $true}
- foreach ($i in $a)
- {
- $subFolderItems = (Get-ChildItem $i.FullName -Recurse | Measure-Object -property length -sum)
- $i.FullName + " -- " + "{0:N2}" -f ($subFolderItems.sum / 1MB) + " MB"
- }
- $b=Get-ChildItem $args -Recurse | Measure-Object -property length -sum
- write-host "----【$args -- ",("{0:N2}" -f ($b.sum / 1MB)),"MB】----"
- }
- }
复制代码 |
|