PowerShell Get Folders And Files Size


  1. 說明
    1. 路徑下所有檔案的大小
    2. 資料夾檔案總和
  2. 相關連結
  3. 參考資料

說明如何使用 PowerShell 計算資料夾與檔案的大小。

logo

說明

路徑下所有檔案的大小

get-childitem | select name, @{Name='FileSize'; Exp = {"{0:N0}" -f ($_.Length / 1KB)}}

資料夾檔案總和

(get-childitem c:\users\sdwh\ | measure Length -s).sum / 1MB

相關連結

PowerShell 使用者不能錯過的 5 個技巧

Powershell 使用物件與資料結構 (Array, Hash)

PowerShell 常用指令筆記

參考資料

MSDocs - Invoke-WebRequest