說明如何使用 PowerShell 計算資料夾與檔案的大小。
說明
路徑下所有檔案的大小
get-childitem | select name, @{Name='FileSize'; Exp = {"{0:N0}" -f ($_.Length / 1KB)}}
資料夾檔案總和
(get-childitem c:\users\sdwh\ | measure Length -s).sum / 1MB
相關連結
Powershell 使用物件與資料結構 (Array, Hash)
說明如何使用 PowerShell 計算資料夾與檔案的大小。
get-childitem | select name, @{Name='FileSize'; Exp = {"{0:N0}" -f ($_.Length / 1KB)}}
(get-childitem c:\users\sdwh\ | measure Length -s).sum / 1MB
Powershell 使用物件與資料結構 (Array, Hash)