Stores the size of a specified file in a property. The file size can be returned in different units.
Table B.28: Attributes
| Name | Type | Description | Default | Required |
|---|---|---|---|---|
file
|
String
| Filename. | n/a | Yes |
propertyname
|
String
| Name of property where the file size is stored. | filesize | No |
unit
|
String
|
File size unit. Examples: | B | No |
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
| Standard | Suffixes | Equivalence |
|---|---|---|
| IEC | B.
| 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 |
<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>