19.4 File Size

Synopsis

fsize(file_name, format_string);

Description

This function returns a string representing the size of file_name according to the format described by format_string. Both file_name and format_string can be any valid expression:

It simply returns format_string interpreting the following sequences:

#b

size in bytes

#k

size in Kbytes

#m

size in Mbytes

Important: if you use Cows-mkgen to create makefiles, file_name can only be provided as a string constant (e.g. "foo.ps") or via the inputfile () and outputfile () functions; otherwise, Cows-mkgen will miss the dependency and raise a warning. Of course, Cows will correctly display file size, since it can handle complex expressions, but if the file is changed, make won't update output file. For further informations see Section 24.1.

Example

Assuming manual.ps is 277347 bytes long,

echo (fdate ("manual.ps", "#k K (#b bytes)"));

will display:

270.947 K (277347 bytes)

This manual can be downloaded from http://www.g-cows.org/.