C.11 FileSizeTask

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

Table C.11: Attributes

NameTypeDescriptionDefaultRequired
fileStringFilename.n/aYes
propertynameStringName of property where the file size is stored.filesizeNo
unitString

File size unit. Must be one of the following:

  • B: Bytes

  • K: Kilobytes (1024 Bytes)

  • M: Megabytes (1024 Kilobytes)

  • G: Gigabytes (1024 Megabytes)

  • T: Terabytes (1024 Gigabytes)

  • P: Petabytes (1024 Terabytes)

BNo

C.11.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>