Created
August 30, 2017 16:06
-
-
Save shaneis/73df095f6bba1562e16f18394ae34b2e to your computer and use it in GitHub Desktop.
Sums the sizes of ".bak", ".diff", and ".trn" files in a folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Get-BackupFilesSizes { | |
$Bak = $Diff = $Trn = 0; | |
$Bak = (Get-ChildItem -File | | |
Where-Object { $_.Extension -eq '.bak' } | | |
Measure-Object -Property Length -Sum).Sum; | |
$Diff = (Get-ChildItem -File | | |
Where-Object { $_.Extension -eq '.diff' } | | |
Measure-Object -Property Length -Sum).Sum; | |
$Trn = (Get-ChildItem -File | | |
Where-Object { $_.Extension -eq '.trn' } | | |
Measure-Object -Property Length -Sum).Sum; | |
[PSCustomObject]@{ | |
'Bak Files (GB)' = $Bak / 1GB | |
'Diff Files (GB)' = $Diff / 1GB | |
'Trn Files (GB)' = $Trn / 1GB | |
}; | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment