how to convert by to Kb, MB or GB

Questions and answers on how to get the most out of FFAStrans
Post Reply
Laurent.madjarian
Posts: 7
Joined: Mon Nov 21, 2016 10:44 pm

how to convert by to Kb, MB or GB

Post by Laurent.madjarian »

Hi everybody,

is there a way to convert byte from %i_original_size% to KiloByte, MegaByte or GigaByte ?


Best,
Laurent.
Laurent.madjarian
Posts: 7
Joined: Mon Nov 21, 2016 10:44 pm

Re: how to convert by to Kb, MB or GB

Post by Laurent.madjarian »

Ok i wrote a simple vbscript to convert %original_size% from byte to KB,MB,GB or TB,
but i dont know how to retreive the result from a command processor ?

in case the script is here:

Code: Select all

' convert byte to KB,MB,GB or TB for ffastrans
' call from command line with cscript byteconvert.vbs %original_size%

val = WScript.Arguments.Item(0)
mult = 1024

If val > mult Then
val = val/mult
unit = " KB"

If val > mult Then
val = val/mult
unit = " MB"

If val > mult Then
val = val/mult
unit = " GB"

If val > mult Then
val = val/mult
unit = " TB"

End If
End If
End If
End If

cscript.echo int(val) & unit
admin
Site Admin
Posts: 1680
Joined: Sat Feb 08, 2014 10:39 pm

Re: how to convert by to Kb, MB or GB

Post by admin »

You can use a combination of "Contitional"-nodes to evaluate the size and then use the "Populate"-nodes and math expressions to create integer variables containing the new rounded value in KB, MB or GB.

-steinar
Post Reply