Sub FormatFileSize(Bytes As Float) As String
Private Unit() As String = Array As String(" Byte", " KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB")
If Bytes = 0 Then
Return "0 Bytes"
Else
Private Po, Si As Double
Private I As Int
Bytes = Abs(Bytes)
I = Floor(Logarithm(Bytes, 1024))
Po = Power(1024, I)
Si = Bytes / Po
Return NumberFormat(Si, 1, 3) & Unit(I)
End If
End Sub