Since Apache Ant 1.7.1
Set the length of one or more files, as the
truncate Unix function or GNU
utility. In addition to working with a single file, this Task can also work
on resources and resource collections.
|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:
||At most one of these; omitting both implies length=
|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
|mkdirs||Whether to create nonexistent parent directories when creating new files.||No; default
You can use any number of nested resource collection elements to define the resources for this task and refer to resources defined elsewhere. Note: resources passed to this task are expected to be filesystem-based.
Set the length of file foo to zero.
Set the length of file foo to 1 kilobyte (1024 bytes).
<truncate file="foo" length="1K"/>
Adjust the length of file foo upward by 1 kilobyte.
<truncate file="foo" adjust="1K"/>
Adjust the length of file foo downward by 1 megabyte.
<truncate file="foo" adjust="-1M"/>