Apache Ant TasksTruncateTruncateDescriptionSet the length of one or more files, as the intermittently availabletruncate Unix utility/function. In addition to working witha single file, this Task can also work onresources and resource collections.Since Apache Ant 1.7.1. Parameters Attribute | Description | Required | file | The name of the file. | Unless a nested resource collection element has been specified. | length | Specifies the new file length (in bytes) to set. The following suffixes are supported: - K : Kilobytes (1024 bytes)
- M : Megabytes (1024 K)
- G : Gigabytes (1024 M)
- T : Terabytes (1024 G)
- P : Petabytes (1024 T)
| At most one of these. Omitting both implies length="0" . | adjust | Specifies the number of bytes (and positive/negative direction) by which to adjust file lengths. The same suffixes are supported for this attribute as for the length attribute. | create | Whether to create nonexistent files. | No, default true. | mkdirs | Whether to create nonexistent parent directories when creating new files. | No, default false. | Parameters specified as nested elementsany resource collectionYou can use any number of nested resource collection elements todefine the resources for this task and refer to resources definedelsewhere. Note: resources passed to this task are expectedto be filesystem-based. Examples <truncate file="foo" /> Sets the length of file foo to zero. <truncate file="foo" length="1K" /> Sets the length of file foo to 1 kilobyte (1024 bytes). <truncate file="foo" adjust="1K" /> Adjusts the length of file foo upward by 1 kilobyte. <truncate file="foo" adjust="-1M" /> Adjusts the length of file foo downward by 1 megabyte. |