Skip to content

Commit

Permalink
Changing size results to double. !deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
gngrninja committed May 22, 2019
1 parent ecb8ca9 commit 1346e90
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 16 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Changing
- Adding tests/official support for Get-FileReport

## [1.6.7] 2019-05-22
### Changed
- Results are now of type double, not string (for MB/GB/Byte count)
- Support for v3.0 of PowerShell, as a lot of folks that use this needed it

### Added
- Initial support for using Robocopy added, only for folders, with the -UseRobo switch

## [1.6.6] 2018-12-10
### Changed
- Adding file counts are now optional. You can add them to the results by adding the -AddFileTotals switch.
Expand Down
18 changes: 9 additions & 9 deletions PSFolderSize/Functions/Public/Get-FolderSize.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -256,18 +256,18 @@ function Get-FolderSize {
if ($UseRobo) {

$folderSize = Get-RoboSize -Path $fullPath -DecimalPrecision 2
$folderSizeInBytes = $folderSize.TotalBytes
$folderSizeInMB = $folderSize.TotalMB
$folderSizeInGB = $folderSize.TotalGB
[double]$folderSizeInBytes = $folderSize.TotalBytes
[double]$folderSizeInMB = $folderSize.TotalMB
[double]$folderSizeInGB = $folderSize.TotalGB

} else {

$folderInfo = Get-Childitem -LiteralPath $fullPath -Recurse -Force -ErrorAction SilentlyContinue
$folderSize = $folderInfo | Measure-Object -Property Length -Sum -ErrorAction SilentlyContinue
#We use the string format operator here to show only 2 decimals, and do some PS Math.
$folderSizeInBytes = $folderSize.Sum
$folderSizeInMB = "{0:N2}" -f ($folderSize.Sum / 1MB)
$folderSizeInGB = "{0:N2}" -f ($folderSize.Sum / 1GB)
[double]$folderSizeInBytes = $folderSize.Sum
[double]$folderSizeInMB = "{0:N2}" -f ($folderSize.Sum / 1MB)
[double]$folderSizeInGB = "{0:N2}" -f ($folderSize.Sum / 1GB)

}

Expand Down Expand Up @@ -306,12 +306,12 @@ function Get-FolderSize {

$folderList | ForEach-Object {

$grandTotal += $_.'Size(Bytes)'
[double]$grandTotal += $_.'Size(Bytes)'

}

$totalFolderSizeInMB = "{0:N2}" -f ($grandTotal / 1MB)
$totalFolderSizeInGB = "{0:N2}" -f ($grandTotal / 1GB)
[double]$totalFolderSizeInMB = "{0:N2}" -f ($grandTotal / 1MB)
[double]$totalFolderSizeInGB = "{0:N2}" -f ($grandTotal / 1GB)

$folderObject = [PSCustomObject]@{

Expand Down
Binary file modified PSFolderSize/PSFolderSize.psd1
Binary file not shown.
2 changes: 0 additions & 2 deletions docs/reference/functions/Get-FileReport.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,9 @@ For more information, see about_CommonParameters (http://go.microsoft.com/fwlink
## INPUTS
### None
## OUTPUTS
### System.Object
## NOTES
## RELATED LINKS
2 changes: 1 addition & 1 deletion docs/reference/functions/PSFolderSize.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
Module Name: PSFolderSize
Module Guid: 36ced1e4-028a-4687-8a7c-7ad4a4ca1df6 36ced1e4-028a-4687-8a7c-7ad4a4ca1df6
Module Guid: 36ced1e4-028a-4687-8a7c-7ad4a4ca1df6
Download Help Link: {{Please enter FwLink manually}}
Help Version: {{Please enter version of help manually (X.X.X.X) format}}
Locale: en-US
Expand Down
6 changes: 2 additions & 4 deletions psake.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ properties {
$projectRoot = $PSScriptRoot

}

$sut = $env:BHModulePath

$tests = "$projectRoot/tests"
$outputDir = Join-Path -Path $projectRoot -ChildPath 'out'
$outputModDir = Join-Path -Path $outputDir -ChildPath $env:BHProjectName
$manifest = Import-PowerShellDataFile -Path $env:BHPSModuleManifest
$outputModVerDir = Join-Path -Path $outputModDir -ChildPath $manifest.ModuleVersion
$manifest = Import-PowerShellDataFile -Path $env:BHPSModuleManifest
$psVersion = $PSVersionTable.PSVersion.Major
$pathSeperator = [IO.Path]::PathSeparator
$dirSeperator = [IO.Path]::DirectorySeparatorChar
Expand Down

0 comments on commit 1346e90

Please sign in to comment.