ow.loadFormat();
var folderPath = ".";
var sumBytes = ow.format.toBytesAbbreviation(
$from( io.listFiles(folderPath).files).sum("size") )
);
print(sumBytes);
In this example it will sum all the byte sizes of a given folder and print you the corresponding abbreviation in bytes.
Other examples:
> ow.format.toBytesAbbreviation(10)
10 bytes
> ow.format.toBytesAbbreviation(10000)
9.77 KB
> ow.format.toBytesAbbreviation(10000000000000)
9.09 TB
No comments:
Post a Comment