B.65 TruncateTask

Modify the length of a file, as the intermittently available truncate Unix utility/function.

When length and adjust are not set an empty file is created.

Table B.68: Attributes

fileStringThe name of the file.n/aYes
lengthStringSpecifies the file size. Examples: 5000B, 250K, 1M. n/aNo
adjustStringThe value to increase or decrease (if you specify a negative value) the size of a file. Examples: -100, 250B, 4K. n/aNo
createBooleanWhether to create nonexistent files.trueNo
mkdirsBooleanWhether to create nonexistent parent directories when creating new files.falseNo


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.69: 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.65.1 Examples

<truncate file="foo" />