fwGestalt() function
Paul Dupuis
paul at researchware.com
Mon Jul 15 21:01:32 EDT 2024
With due credit to Richard for the original, you might want to update it
for today's disk sizes, This adds GB and TB
function Bytes2Size n
set the numberformat to "0.#"
if n < 1024 then
put n &" bytes" into n
else
put n / 1024 into n
if n < 1024 then
put n &" KB" into n
else
put n / 1024 into n
if n < 1024 then
put n &" MB" into n
else
put n / 1024 into n
if n < 1024 then
put n &" GB" into n
else
put n / 1024 &" TB" into n
end if
end if
end if
end if
return n
end Bytes2Size
On 7/15/2024 7:24 PM, Bob Sneidar via use-livecode wrote:
> Thanks Richard.
>
> Bob S
>
>
> On Jul 15, 2024, at 4:07 PM, Richard Gaskin via use-livecode <use-livecode at lists.runrev.com> wrote:
>
> function Bytes2Size n
> set the numberformat to "0.#"
> if n < 1024 then put n &" bytes" into n
> else
> put n / 1024 into n
> if n < 1024 then put n &" k" into n
> else
> put n / 1024 &" MB" into n
> end if
> end if
> return n
> end Bytes2Size
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list