B.26 FileSizeTask

Stores the size of a specified file in a property. The file size can be returned in different units.

Table B.28: Attributes

propertynameStringName of property where the file size is stored.filesizeNo

File size unit. Examples: M, G, T.



File size can be written using IEC and SI suffixes, bytes are assumed when suffix is not specified. The following suffixes (case-insensitive) are supported:

Table B.29: Supported file size suffixes

IECB. 1 byte
K, Ki, KiB, kibi, kibibyte. 1024 bytes
M, Mi, MiB, mebi, mebibyte. 1024 kibibytes
G, Gi, GiB, gibi, gibibyte. 1024 mebibytes
T, Ti, TiB, tebi, tebibyte. 1024 gibibytes
SI kB, kilo, kilobyte. 1000 bytes
MB, mega, megabyte. 1000 kilobytes
GB, giga, gigabyte. 1000 megabytes
TB, tera, terabyte. 1000 gigabytes

B.26.1 Examples

                <filesize file="./backup.zip"/>
                <echo>Your backup size is ${filesize} Bytes</echo>
                <filesize file="./backup.zip" propertyname="backup.size"/>
                <echo>Your backup size is ${backup.size} Bytes</echo>
                <filesize file="./backup.zip" unit="M"/>
                <echo>Your backup size is ${filesize} Megabytes</echo>