2001-02-13 12:32:01 +00:00
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Language" content="en-us">
|
2005-04-29 18:58:16 +00:00
|
|
|
<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
2002-02-03 22:00:42 +00:00
|
|
|
<title>Touch Task</title>
|
2001-02-13 12:32:01 +00:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<h2><a name="touch">Touch</a></h2>
|
|
|
|
<h3>Description</h3>
|
|
|
|
<p>Changes the modification time of a file and possibly creates it at
|
2001-03-29 09:37:12 +00:00
|
|
|
the same time. In addition to working with a single file, this Task
|
|
|
|
can also work a <a href="../CoreTypes/fileset.html">Fileset</a> (which
|
2004-01-07 17:49:37 +00:00
|
|
|
also includes directories)
|
|
|
|
or a <a href="../CoreTypes/filelist.html">Filelist</a> (since Ant 1.6).</p>
|
2001-02-13 12:32:01 +00:00
|
|
|
<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>
|
2004-12-14 17:56:35 +00:00
|
|
|
<td valign="top">The name of the file.</td>
|
|
|
|
<td valign="top" align="center">Unless a nested fileset element
|
|
|
|
or a nested filelist element has been specified.</td>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">millis</td>
|
2004-12-14 17:56:35 +00:00
|
|
|
<td valign="top">Specifies the new modification time of the file
|
|
|
|
in milliseconds since midnight Jan 1 1970.</td>
|
|
|
|
<td valign="center" align="center" rowspan="2">No--datetime takes
|
|
|
|
precedence, however if both are omitted the current time is assumed.</td>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">datetime</td>
|
2004-12-14 17:56:35 +00:00
|
|
|
<td valign="top">Specifies the new modification time of the file.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">pattern</td>
|
|
|
|
<td valign="top">SimpleDateFormat-compatible pattern string.
|
|
|
|
Defaults to MM/DD/YYYY HH:MM AM_or_PM or MM/DD/YYYY HH:MM:SS AM_or_PM.
|
|
|
|
<b>Since Ant 1.6.3</b></td>
|
2001-02-13 12:32:01 +00:00
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
2004-12-14 17:56:35 +00:00
|
|
|
<tr>
|
|
|
|
<td valign="top">mkdirs</td>
|
|
|
|
<td valign="top">Whether to create nonexistent parent
|
|
|
|
directories when touching new files. <b>Since Ant 1.6.3</b></td>
|
|
|
|
<td valign="top" align="center">No, default <i>false</i>.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">verbose</td>
|
|
|
|
<td valign="top">Whether to log the creation of new files.
|
|
|
|
<b>Since Ant 1.6.3</b></td>
|
|
|
|
<td valign="top" align="center">No, default <i>true</i>.</td>
|
|
|
|
</tr>
|
2001-02-13 12:32:01 +00:00
|
|
|
</table>
|
2004-12-14 17:56:35 +00:00
|
|
|
<h3>Parameters specified as nested elements</h3>
|
2005-01-22 20:08:55 +00:00
|
|
|
<h4>fileset</h4>
|
|
|
|
<p>You can use any number of nested <code><fileset></code>
|
|
|
|
elements to define the files for this task and refer to
|
|
|
|
<code><fileset></code>s defined elsewhere.</p>
|
|
|
|
<h4>filelist</h4>
|
|
|
|
<p><em>Since Ant 1.6</em></p>
|
|
|
|
<p>You can use any number of nested <code><filelist></code>
|
|
|
|
elements to define the files for this task and refer to
|
|
|
|
<code><filelist></code>s defined elsewhere.</p>
|
|
|
|
|
|
|
|
<h4>mapper</h4>
|
|
|
|
<p><em>Since Ant 1.6.3,</em> a nested <a href="../CoreTypes/mapper.html">
|
2004-12-14 17:56:35 +00:00
|
|
|
mapper</a> can be specified. Files specified via nested
|
|
|
|
<code>fileset</code>s, <code>filelist</code>s, or the <code>file</code>
|
|
|
|
attribute are mapped using the specified mapper. For each file mapped,
|
|
|
|
the resulting files are touched. If the original file exists its
|
|
|
|
timestamp will be used. Otherwise the task settings (<code>millis</code>,
|
|
|
|
<code>datetime</code>) take effect.</p>
|
2001-02-13 12:32:01 +00:00
|
|
|
<h3>Examples</h3>
|
|
|
|
<pre> <touch file="myfile"/></pre>
|
|
|
|
<p>creates <code>myfile</code> if it doesn't exist and changes the
|
|
|
|
modification time to the current time.</p>
|
|
|
|
<pre> <touch file="myfile" datetime="06/28/2000 2:02 pm"/></pre>
|
|
|
|
<p>creates <code>myfile</code> if it doesn't exist and changes the
|
|
|
|
modification time to Jun, 28 2000 2:02 pm (14:02 for those used to 24
|
|
|
|
hour times).</p>
|
2001-03-29 09:37:12 +00:00
|
|
|
<pre> <touch datetime="09/10/1974 4:30 pm">
|
|
|
|
<fileset dir="src_dir"/>
|
|
|
|
</touch></pre>
|
|
|
|
<p>changes the modification time to Oct, 09 1974 4:30 pm of all files and directories
|
|
|
|
found in <code>src_dir</code>. </p>
|
2003-06-24 12:46:57 +00:00
|
|
|
<pre> <touch file="myfile" datetime="06/28/2000 2:02:17 pm"/></pre>
|
|
|
|
<p>creates <code>myfile</code> if it doesn't exist and changes the
|
|
|
|
modification time to Jun, 28 2000 2:02:17 pm (14:02:17 for those used to 24
|
|
|
|
hour times), if the filesystem allows a precision of one second - a
|
|
|
|
time close to it otherwise.</p>
|
2004-12-14 17:56:35 +00:00
|
|
|
<pre> <touch file="foo">
|
|
|
|
<mapper type="glob" from="foo" to="bar" />
|
|
|
|
</touch>
|
|
|
|
</pre>
|
|
|
|
<p>creates <code>bar</code> if it doesn't exist and changes the
|
|
|
|
modification time to that of <code>foo</code>.</p>
|
2001-02-13 12:32:01 +00:00
|
|
|
<hr>
|
2005-01-22 20:08:55 +00:00
|
|
|
<p align="center">Copyright © 2000-2001,2003-2005 The Apache Software Foundation. All rights
|
2001-02-13 12:32:01 +00:00
|
|
|
Reserved.</p>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|