Proposal: Human readably output for file sizes

Human readable sizes would be nice, so that

Packed mysql.daily.dump.0.gz (435200)

becomes

Packed mysql.daily.dump.0.gz (425 K)

3 Likes

Personally, I would prefer to know the exact file sizes in bytes for diagnostic purposes - that’s really what the detailed logs are mainly for anyway, imo. Though if there was a -[hH] option, that might be useful.

2 Likes

I like both options for pretty printing sizes and think both are useful (since i am both an admin and a normal user).

Here’s a third option to make decisions harder: what if we show full size in bytes, but use the system’s locale thousands separator (or maybe a user-chosen character), so size 7463892435298 would become 7_463_892_435_298 in case the user chooses _ as separator, 7.463.892.435.298 if the locale is non US, or 7,463,892,435,298 if the locale is US.

For reference here is my current locale on windows:

PS C:\Users\crist> Get-Culture

LCID             Name             DisplayName
----             ----             -----------
1033             en-US            English (United States)


PS C:\Users\crist>  (Get-Culture).NumberFormat.NumberGroupSeparator
,
PS C:\Users\crist>  (Get-Culture).NumberFormat


CurrencyDecimalDigits    : 2
CurrencyDecimalSeparator : .
IsReadOnly               : False
CurrencyGroupSizes       : {3}
NumberGroupSizes         : {3}
PercentGroupSizes        : {3}
CurrencyGroupSeparator   : ,
CurrencySymbol           : $
NaNSymbol                : NaN
CurrencyNegativePattern  : 0
NumberNegativePattern    : 1
PercentPositivePattern   : 1
PercentNegativePattern   : 1
NegativeInfinitySymbol   : -∞
NegativeSign             : -
NumberDecimalDigits      : 2
NumberDecimalSeparator   : .
NumberGroupSeparator     : ,          // this is the one
CurrencyPositivePattern  : 0
PositiveInfinitySymbol   : ∞
PositiveSign             : +
PercentDecimalDigits     : 2
PercentDecimalSeparator  : .
PercentGroupSeparator    : ,
PercentSymbol            : %
PerMilleSymbol           : ‰
NativeDigits             : {0, 1, 2, 3...}
DigitSubstitution        : None

And here’s what oracle docs say about number localisation.

If i would do this just for me, I would be happy to have the sizes pretty-printed with _ or . as separator and call it a day.