Get File Size in KB, MB, GB

PHOTO EMBED

Mon Oct 31 2022 02:56:23 GMT+0000 (Coordinated Universal Time)

Saved by @tgran2028 #powershell #file #filesystem #measure

$filename = 'D:\PS\CSV\PowerShell-EventLogs.csv'    

# Get file size in bytes
(Get-Item -Path $filename).Length

# get file size in KB in PowerShell
(Get-Item -Path $filename).Length/1KB

# get file size in MB in PowerShell   
(Get-Item -Path $filename).Length/1MB

# get file size in GB in PowerShell
(Get-Item -Path $filename).Length/1GB  
content_copyCOPY

https://shellgeek.com/powershell-get-file-size/