mirror of
https://github.com/apache/ant.git
synced 2025-05-18 14:04:48 +00:00
git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@513901 13f79535-47bb-0310-9956-ffa450edef68
107 lines
3.6 KiB
HTML
107 lines
3.6 KiB
HTML
<!--
|
|
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>
|
|
|
|
<h2><a name="touch">Truncate</a></h2>
|
|
<h3>Description</h3>
|
|
|
|
<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 on
|
|
<a href="../CoreTypes/resource.html">resources</a> and resource collections.
|
|
<strong>Since Ant 1.7.1</strong>.
|
|
</p>
|
|
|
|
<h3>Parameters</h3>
|
|
<table border="1" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td valign="top"><b>Attribute</b></td>
|
|
<td valign="top"><b>Description</b></td>
|
|
<td align="center" valign="top"><b>Required</b></td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">file</td>
|
|
<td valign="top">The name of the file.</td>
|
|
<td valign="top" align="center">Unless a nested resource collection element
|
|
has been specified.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">length</td>
|
|
<td valign="top">Specifies the new file length to set. The following
|
|
suffixes are supported:
|
|
<ul>
|
|
<li>K : Kilobytes (1024 bytes)</li>
|
|
<li>M : Megabytes (1024 K)</li>
|
|
<li>G : Gigabytes (1024 M)</li>
|
|
<li>T : Terabytes (1024 G)</li>
|
|
<li>P : Petabytes (1024 T)</li>
|
|
</ul>
|
|
</td>
|
|
<td valign="center" align="center" rowspan="2">One of these or neither.
|
|
Specifying neither is equivalent to length="0".
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">adjust</td>
|
|
<td valign="top">Specifies the amount (and positive/negative direction)
|
|
by which to adjust file lengths.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">create</td>
|
|
<td valign="top">Whether to create nonexistent files.</td>
|
|
<td valign="top" align="center">No, default <i>true</i>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">mkdirs</td>
|
|
<td valign="top">Whether to create nonexistent parent
|
|
directories when creating new files.</td>
|
|
<td valign="top" align="center">No, default <i>false</i>.</td>
|
|
</tr>
|
|
</table>
|
|
<h3>Parameters specified as nested elements</h3>
|
|
<h4>any resource collection</h4>
|
|
|
|
<p>You can use any number of nested resource collection elements to
|
|
define the resources for this task and refer to resources defined
|
|
elsewhere. <b>Note:</b> resources passed to this task are expected
|
|
to be filesystem-based.</p>
|
|
|
|
<h3>Examples</h3>
|
|
|
|
<pre> <truncate file="foo" /></pre>
|
|
<p>Sets the length of file <code>foo</code> to zero.</p>
|
|
|
|
<pre> <truncate file="foo" length="1K" /></pre>
|
|
<p>Sets the length of file <code>foo</code> to 1 kilobyte (1024 bytes).</p>
|
|
|
|
<pre> <truncate file="foo" adjust="1K" /></pre>
|
|
<p>Adjusts the length of file <code>foo</code> upward by 1 kilobyte.</p>
|
|
|
|
<pre> <truncate file="foo" adjust="-1M" /></pre>
|
|
<p>Adjusts the length of file <code>foo</code> downward by 1 megabyte.</p>
|
|
|
|
</body>
|
|
</html>
|