Skip to content

Instantly share code, notes, and snippets.

@Delivator
Created January 3, 2023 00:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Delivator/1a1661c2dbbc28225311f55bd0f3f388 to your computer and use it in GitHub Desktop.
Save Delivator/1a1661c2dbbc28225311f55bd0f3f388 to your computer and use it in GitHub Desktop.
Param(
[Parameter(Mandatory=$True)]
[string]$Original,
[Parameter(Mandatory=$True)]
[string]$Compare
)
$OriginalSize = (Get-ChildItem $Original | Measure-Object Length -Sum).sum / 1Gb
$CompareSize = (Get-ChildItem $Compare | Measure-Object Length -Sum).sum / 1Gb
[string]$Difference
if ($OriginalSize -lt $CompareSize) {
$Percent = [math]::Round(((($OriginalSize / $CompareSize)-1)*-100),2)
$Difference = "$Percent% Larger"
} else {
$Percent = [math]::Round(((($CompareSize / $OriginalSize)-1)*-100),2)
$Difference = "$Percent% Smaller"
}
Write-Host "Before:"("{0:N2} GB" -f ($OriginalSize))
Write-Host "After:"("{0:N2} GB ($Difference)" -f ($CompareSize))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment