LoginSignup
16
12

More than 5 years have passed since last update.

Pwershellで du コマンド

Posted at

ディスクが圧迫してきたときとかどこが容量食ってるのか調べるのにLinuxだとdu -shとか使って調べていくかと思います

Windowsで調べる場合どうしようと思って調べてみました

Powershellを起動して気になるディレクトリに移動して下記

ls | ForEach-Object -Process { "$_"; Get-ChildItem -Path "$_" -Recurse -Force | ForEach-Object -Begin { $Len = 0 } -Process { $Len = $Len + $_.Length } -End { $Len / 1024 / 1024 / 1024 }; " " }
misc53
4.32837117649615

misc54
5.1540436539799

misc55
2.45968135166913

カレントディレクトリ以下のファイル、もしくはディレクトリの総容量(GB)を出してくれます

調べるにあたってちょっと時間がかかったのでメモ

16
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16
12