source: release-kits/lirk3/resources/gs3-release-maker/ant/docs/manual/CoreTasks/touch.html@ 14982

Last change on this file since 14982 was 14982, checked in by oranfry, 16 years ago

initial import of LiRK3

File size: 4.5 KB
Line 
1<html>
2
3<head>
4<meta http-equiv="Content-Language" content="en-us">
5<title>Touch Task</title>
6<link rel="stylesheet" type="text/css" href="../stylesheets/antmanual.css">
7</head>
8
9<body>
10
11<h2><a name="touch">Touch</a></h2>
12<h3>Description</h3>
13<p>Changes the modification time of a file and possibly creates it at
14the same time. In addition to working with a single file, this Task
15can also work a <a href="../CoreTypes/fileset.html">Fileset</a> (which
16also includes directories)
17or a <a href="../CoreTypes/filelist.html">Filelist</a> (since Ant 1.6).</p>
18<h3>Parameters</h3>
19<table border="1" cellpadding="2" cellspacing="0">
20 <tr>
21 <td valign="top"><b>Attribute</b></td>
22 <td valign="top"><b>Description</b></td>
23 <td align="center" valign="top"><b>Required</b></td>
24 </tr>
25 <tr>
26 <td valign="top">file</td>
27 <td valign="top">The name of the file.</td>
28 <td valign="top" align="center">Unless a nested fileset element
29 or a nested filelist element has been specified.</td>
30 </tr>
31 <tr>
32 <td valign="top">millis</td>
33 <td valign="top">Specifies the new modification time of the file
34 in milliseconds since midnight Jan 1 1970.</td>
35 <td valign="center" align="center" rowspan="2">No--datetime takes
36 precedence, however if both are omitted the current time is assumed.</td>
37 </tr>
38 <tr>
39 <td valign="top">datetime</td>
40 <td valign="top">Specifies the new modification time of the file.</td>
41 </tr>
42 <tr>
43 <td valign="top">pattern</td>
44 <td valign="top">SimpleDateFormat-compatible pattern string.
45 Defaults to MM/DD/YYYY HH:MM AM_or_PM or MM/DD/YYYY HH:MM:SS AM_or_PM.
46 <b>Since Ant 1.6.3</b></td>
47 <td valign="top" align="center">No</td>
48 </tr>
49 <tr>
50 <td valign="top">mkdirs</td>
51 <td valign="top">Whether to create nonexistent parent
52 directories when touching new files. <b>Since Ant 1.6.3</b></td>
53 <td valign="top" align="center">No, default <i>false</i>.</td>
54 </tr>
55 <tr>
56 <td valign="top">verbose</td>
57 <td valign="top">Whether to log the creation of new files.
58 <b>Since Ant 1.6.3</b></td>
59 <td valign="top" align="center">No, default <i>true</i>.</td>
60 </tr>
61</table>
62<h3>Parameters specified as nested elements</h3>
63<h4>fileset</h4>
64<p>You can use any number of nested <code>&lt;fileset&gt;</code>
65elements to define the files for this task and refer to
66<code>&lt;fileset&gt;</code>s defined elsewhere.</p>
67<h4>filelist</h4>
68<p><em>Since Ant 1.6</em></p>
69<p>You can use any number of nested <code>&lt;filelist&gt;</code>
70elements to define the files for this task and refer to
71<code>&lt;filelist&gt;</code>s defined elsewhere.</p>
72
73<h4>mapper</h4>
74<p><em>Since Ant 1.6.3,</em> a nested <a href="../CoreTypes/mapper.html">
75 mapper</a> can be specified. Files specified via nested
76 <code>fileset</code>s, <code>filelist</code>s, or the <code>file</code>
77 attribute are mapped using the specified mapper. For each file mapped,
78 the resulting files are touched. If the original file exists its
79 timestamp will be used. Otherwise the task settings (<code>millis</code>,
80 <code>datetime</code>) take effect.</p>
81<h3>Examples</h3>
82<pre> &lt;touch file=&quot;myfile&quot;/&gt;</pre>
83<p>creates <code>myfile</code> if it doesn't exist and changes the
84modification time to the current time.</p>
85<pre> &lt;touch file=&quot;myfile&quot; datetime=&quot;06/28/2000 2:02 pm&quot;/&gt;</pre>
86<p>creates <code>myfile</code> if it doesn't exist and changes the
87modification time to Jun, 28 2000 2:02 pm (14:02 for those used to 24
88hour times).</p>
89<pre> &lt;touch datetime=&quot;09/10/1974 4:30 pm&quot;&gt;
90 &lt;fileset dir=&quot;src_dir&quot;/&gt;
91 &lt;/touch&gt;</pre>
92<p>changes the modification time to Oct, 09 1974 4:30 pm of all files and directories
93 found in <code>src_dir</code>. </p>
94<pre> &lt;touch file=&quot;myfile&quot; datetime=&quot;06/28/2000 2:02:17 pm&quot;/&gt;</pre>
95<p>creates <code>myfile</code> if it doesn't exist and changes the
96modification time to Jun, 28 2000 2:02:17 pm (14:02:17 for those used to 24
97hour times), if the filesystem allows a precision of one second - a
98time close to it otherwise.</p>
99<pre> &lt;touch file=&quot;foo&quot;&gt;
100 &lt;mapper type=&quot;glob&quot; from=&quot;foo&quot; to=&quot;bar&quot; /&gt;
101 &lt;/touch&gt;
102</pre>
103<p>creates <code>bar</code> if it doesn't exist and changes the
104modification time to that of <code>foo</code>.</p>
105<hr>
106<p align="center">Copyright &copy; 2000-2001,2003-2005 The Apache Software Foundation. All rights
107Reserved.</p>
108
109</body>
110</html>
Note: See TracBrowser for help on using the repository browser.