読者です 読者をやめる 読者になる 読者になる

うまいぼうぶろぐ

linuxとhttpdとperlのメモ

powershellで容量の多いディレクトリ調べる

windows
> function dusage{
  param([String]$tgtDir = (pwd).Path)

  filter dusage_filter{
    $sum = (dir -literalpath $_.FullName -recurse -force -erroraction silentlycontinue |
      measure-object Length -sum).Sum
    $result = New-Object Object |
      Add-Member NoteProperty Folder $_.FullName -PassThru |
      Add-Member NoteProperty Size $sum -PassThru 
    return $result 
  }

  dir $tgtDir -force -erroraction silentlycontinue |
    ? {$_.PSIsContainer} | dusage_filter 
}

> dusage -tgtDir "c:\work" | sort -des size