2007-03-02 19:27:56 +00:00
|
|
|
<!--
|
|
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
|
|
this work for additional information regarding copyright ownership.
|
|
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
(the "License"); you may not use this file except in compliance with
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
-->
|
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Language" content="en-us">
|
|
|
|
<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
|
|
|
<title>Truncate Task</title>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h2 id="touch">Truncate</h2>
|
2018-03-04 15:17:41 +01:00
|
|
|
<p><em>Since Apache Ant 1.7.1</em></p>
|
2007-03-02 19:27:56 +00:00
|
|
|
<h3>Description</h3>
|
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Set the length of one or more files, as the intermittently available <code>truncate</code> Unix
|
|
|
|
utility/function. In addition to working with a single file, this Task can also work
|
2018-03-04 15:17:41 +01:00
|
|
|
on <a href="../Types/resources.html">resources</a> and resource collections.</p>
|
2007-03-02 19:27:56 +00:00
|
|
|
|
|
|
|
<h3>Parameters</h3>
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2007-03-02 19:27:56 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<th>Attribute</th>
|
|
|
|
<th>Description</th>
|
|
|
|
<th>Required</th>
|
2007-03-02 19:27:56 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>file</td>
|
|
|
|
<td>The name of the file.</td>
|
|
|
|
<td>Unless a nested resource collection element has been specified</td>
|
2007-03-02 19:27:56 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>length</td>
|
|
|
|
<td>Specifies the new file length (in bytes) to set. The following suffixes are supported:
|
2007-03-07 16:09:42 +00:00
|
|
|
<ul>
|
2018-02-28 07:58:59 +01:00
|
|
|
<li><q>K</q> : Kilobytes (1024 bytes)</li>
|
|
|
|
<li><q>M</q> : Megabytes (1024 K)</li>
|
|
|
|
<li><q>G</q> : Gigabytes (1024 M)</li>
|
|
|
|
<li><q>T</q> : Terabytes (1024 G)</li>
|
|
|
|
<li><q>P</q> : Petabytes (1024 T)</li>
|
2007-03-07 16:09:42 +00:00
|
|
|
</ul>
|
|
|
|
</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td rowspan="2">At most one of these; omitting both implies <var>length</var>=<q>0</q>
|
2007-03-02 19:27:56 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>adjust</td>
|
|
|
|
<td class="left">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 <var>length</var> attribute.
|
2007-03-07 16:09:42 +00:00
|
|
|
</td>
|
2007-03-02 19:27:56 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>create</td>
|
|
|
|
<td>Whether to create nonexistent files.</td>
|
|
|
|
<td>No; default <q>true</q></td>
|
2007-03-02 19:27:56 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>mkdirs</td>
|
|
|
|
<td>Whether to create nonexistent parent directories when creating new files.</td>
|
|
|
|
<td>No; default <q>false</q></td>
|
2007-03-02 19:27:56 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<h3>Parameters specified as nested elements</h3>
|
|
|
|
<h4>any resource collection</h4>
|
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>You can use any number of nested resource collection elements to define the resources for this
|
|
|
|
task and refer to resources defined elsewhere. <strong>Note</strong>: resources passed to this task
|
|
|
|
are expected to be filesystem-based.</p>
|
2007-03-02 19:27:56 +00:00
|
|
|
|
|
|
|
<h3>Examples</h3>
|
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<pre><truncate file="foo"/></pre>
|
|
|
|
<p>Sets the length of file <samp>foo</samp> to zero.</p>
|
2007-03-02 19:27:56 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<pre><truncate file="foo" length="1K"/></pre>
|
|
|
|
<p>Sets the length of file <samp>foo</samp> to 1 kilobyte (1024 bytes).</p>
|
2007-03-02 19:27:56 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<pre><truncate file="foo" adjust="1K"/></pre>
|
|
|
|
<p>Adjusts the length of file <samp>foo</samp> upward by 1 kilobyte.</p>
|
2007-03-02 19:27:56 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<pre><truncate file="foo" adjust="-1M"/></pre>
|
|
|
|
<p>Adjusts the length of file <samp>foo</samp> downward by 1 megabyte.</p>
|
2007-03-02 19:27:56 +00:00
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|