24 lines
504 B
PowerShell
24 lines
504 B
PowerShell
# gitea.RdzeN.net
|
|
#
|
|
# Get filesize.
|
|
|
|
function Get-FileSize {
|
|
param (
|
|
[string]$FilePath
|
|
)
|
|
|
|
$fileInfo = Get-Item $FilePath
|
|
$fileSizeBytes = $fileInfo.Length
|
|
|
|
$fileSizeKB = [math]::Round($fileSizeBytes / 1KB, 2)
|
|
$fileSizeMB = [math]::Round($fileSizeBytes / 1MB, 2)
|
|
$fileSizeGB = [math]::Round($fileSizeBytes / 1GB, 2)
|
|
|
|
return [PSCustomObject]@{
|
|
"Bytes" = $fileSizeBytes
|
|
"KB" = $fileSizeKB
|
|
"MB" = $fileSizeMB
|
|
"GB" = $fileSizeGB
|
|
}
|
|
}
|