1 | <!--
|
---|
2 | Licensed to the Apache Software Foundation (ASF) under one or more
|
---|
3 | contributor license agreements. See the NOTICE file distributed with
|
---|
4 | this work for additional information regarding copyright ownership.
|
---|
5 | The ASF licenses this file to You under the Apache License, Version 2.0
|
---|
6 | (the "License"); you may not use this file except in compliance with
|
---|
7 | the License. You may obtain a copy of the License at
|
---|
8 |
|
---|
9 | http://www.apache.org/licenses/LICENSE-2.0
|
---|
10 |
|
---|
11 | Unless required by applicable law or agreed to in writing, software
|
---|
12 | distributed under the License is distributed on an "AS IS" BASIS,
|
---|
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
14 | See the License for the specific language governing permissions and
|
---|
15 | limitations under the License.
|
---|
16 | -->
|
---|
17 | <html>
|
---|
18 |
|
---|
19 | <head>
|
---|
20 | <meta http-equiv="Content-Language" content="en-us">
|
---|
21 | <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
---|
22 | <title>Touch Task</title>
|
---|
23 | </head>
|
---|
24 |
|
---|
25 | <body>
|
---|
26 |
|
---|
27 | <h2><a name="touch">Touch</a></h2>
|
---|
28 | <h3>Description</h3>
|
---|
29 |
|
---|
30 | <p>Changes the modification time of a resource and possibly creates it
|
---|
31 | at the same time. In addition to working with a single file, this Task
|
---|
32 | can also work on <a href="../CoreTypes/resource.html">resource</a> and
|
---|
33 | resource collections (which also includes directories). Prior to Ant
|
---|
34 | 1.7 only FileSet or <a href="../CoreTypes/filelist.html">Filelist</a>
|
---|
35 | (since Ant 1.6) have been supported.</p>
|
---|
36 |
|
---|
37 | <h3>Parameters</h3>
|
---|
38 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
39 | <tr>
|
---|
40 | <td valign="top"><b>Attribute</b></td>
|
---|
41 | <td valign="top"><b>Description</b></td>
|
---|
42 | <td align="center" valign="top"><b>Required</b></td>
|
---|
43 | </tr>
|
---|
44 | <tr>
|
---|
45 | <td valign="top">file</td>
|
---|
46 | <td valign="top">The name of the file.</td>
|
---|
47 | <td valign="top" align="center">Unless a nested resource collection element
|
---|
48 | has been specified.</td>
|
---|
49 | </tr>
|
---|
50 | <tr>
|
---|
51 | <td valign="top">millis</td>
|
---|
52 | <td valign="top">Specifies the new modification time of the file
|
---|
53 | in milliseconds since midnight Jan 1 1970.</td>
|
---|
54 | <td valign="center" align="center" rowspan="2">No--datetime takes
|
---|
55 | precedence, however if both are omitted the current time is assumed.</td>
|
---|
56 | </tr>
|
---|
57 | <tr>
|
---|
58 | <td valign="top">datetime</td>
|
---|
59 | <td valign="top">Specifies the new modification time of the file.</td>
|
---|
60 | </tr>
|
---|
61 | <tr>
|
---|
62 | <td valign="top">pattern</td>
|
---|
63 | <td valign="top">SimpleDateFormat-compatible pattern string.
|
---|
64 | Defaults to MM/DD/YYYY HH:MM AM_or_PM or MM/DD/YYYY HH:MM:SS AM_or_PM.
|
---|
65 | <b>Since Ant 1.6.3</b></td>
|
---|
66 | <td valign="top" align="center">No</td>
|
---|
67 | </tr>
|
---|
68 | <tr>
|
---|
69 | <td valign="top">mkdirs</td>
|
---|
70 | <td valign="top">Whether to create nonexistent parent
|
---|
71 | directories when touching new files. <b>Since Ant 1.6.3</b></td>
|
---|
72 | <td valign="top" align="center">No, default <i>false</i>.</td>
|
---|
73 | </tr>
|
---|
74 | <tr>
|
---|
75 | <td valign="top">verbose</td>
|
---|
76 | <td valign="top">Whether to log the creation of new files.
|
---|
77 | <b>Since Ant 1.6.3</b></td>
|
---|
78 | <td valign="top" align="center">No, default <i>true</i>.</td>
|
---|
79 | </tr>
|
---|
80 | </table>
|
---|
81 | <h3>Parameters specified as nested elements</h3>
|
---|
82 | <h4>any resource collection</h4>
|
---|
83 |
|
---|
84 | <p>You can use any number of nested resource collection elements to
|
---|
85 | define the resource for this task and refer to resources defined
|
---|
86 | elsewhere. <b>Note:</b> resource passed to this task must implement
|
---|
87 | the <code>org.apache.tools.ant.types.resources.Touchable</code>
|
---|
88 | interface, this is true for all filesystem-based resources like those
|
---|
89 | returned by path, fileset ot filelist.</p>
|
---|
90 |
|
---|
91 | <p>For backwards compatibility directories matched by nested filesets
|
---|
92 | will be "touched" as well, use a <type> selector to suppress
|
---|
93 | this. This only applies to filesets nested into the task directly,
|
---|
94 | not to filesets nested into a path or any other resource
|
---|
95 | collection.</p>
|
---|
96 |
|
---|
97 | <h4>mapper</h4>
|
---|
98 | <p><em>Since Ant 1.6.3,</em> a nested <a href="../CoreTypes/mapper.html">
|
---|
99 | mapper</a> can be specified. Files specified via nested
|
---|
100 | <code>fileset</code>s, <code>filelist</code>s, or the <code>file</code>
|
---|
101 | attribute are mapped using the specified mapper. For each file mapped,
|
---|
102 | the resulting files are touched. If the original file exists its
|
---|
103 | timestamp will be used. Otherwise the task settings (<code>millis</code>,
|
---|
104 | <code>datetime</code>) take effect.</p>
|
---|
105 | <h3>Examples</h3>
|
---|
106 | <pre> <touch file="myfile"/></pre>
|
---|
107 | <p>creates <code>myfile</code> if it doesn't exist and changes the
|
---|
108 | modification time to the current time.</p>
|
---|
109 | <pre> <touch file="myfile" datetime="06/28/2000 2:02 pm"/></pre>
|
---|
110 | <p>creates <code>myfile</code> if it doesn't exist and changes the
|
---|
111 | modification time to Jun, 28 2000 2:02 pm (14:02 for those used to 24
|
---|
112 | hour times).</p>
|
---|
113 | <pre> <touch datetime="09/10/1974 4:30 pm">
|
---|
114 | <fileset dir="src_dir"/>
|
---|
115 | </touch></pre>
|
---|
116 | <p>changes the modification time to Oct, 09 1974 4:30 pm of all files and directories
|
---|
117 | found in <code>src_dir</code>. </p>
|
---|
118 | <pre> <touch file="myfile" datetime="06/28/2000 2:02:17 pm"/></pre>
|
---|
119 | <p>creates <code>myfile</code> if it doesn't exist and changes the
|
---|
120 | modification time to Jun, 28 2000 2:02:17 pm (14:02:17 for those used to 24
|
---|
121 | hour times), if the filesystem allows a precision of one second - a
|
---|
122 | time close to it otherwise.</p>
|
---|
123 | <pre> <touch file="foo">
|
---|
124 | <mapper type="glob" from="foo" to="bar" />
|
---|
125 | </touch>
|
---|
126 | </pre>
|
---|
127 | <p>creates <code>bar</code> if it doesn't exist and changes the
|
---|
128 | modification time to that of <code>foo</code>.</p>
|
---|
129 |
|
---|
130 |
|
---|
131 | </body>
|
---|
132 | </html>
|
---|