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
|
---|
14 | the same time. In addition to working with a single file, this Task
|
---|
15 | can also work a <a href="../CoreTypes/fileset.html">Fileset</a> (which
|
---|
16 | also includes directories)
|
---|
17 | or 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><fileset></code>
|
---|
65 | elements to define the files for this task and refer to
|
---|
66 | <code><fileset></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><filelist></code>
|
---|
70 | elements to define the files for this task and refer to
|
---|
71 | <code><filelist></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> <touch file="myfile"/></pre>
|
---|
83 | <p>creates <code>myfile</code> if it doesn't exist and changes the
|
---|
84 | modification time to the current time.</p>
|
---|
85 | <pre> <touch file="myfile" datetime="06/28/2000 2:02 pm"/></pre>
|
---|
86 | <p>creates <code>myfile</code> if it doesn't exist and changes the
|
---|
87 | modification time to Jun, 28 2000 2:02 pm (14:02 for those used to 24
|
---|
88 | hour times).</p>
|
---|
89 | <pre> <touch datetime="09/10/1974 4:30 pm">
|
---|
90 | <fileset dir="src_dir"/>
|
---|
91 | </touch></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> <touch file="myfile" datetime="06/28/2000 2:02:17 pm"/></pre>
|
---|
95 | <p>creates <code>myfile</code> if it doesn't exist and changes the
|
---|
96 | modification time to Jun, 28 2000 2:02:17 pm (14:02:17 for those used to 24
|
---|
97 | hour times), if the filesystem allows a precision of one second - a
|
---|
98 | time close to it otherwise.</p>
|
---|
99 | <pre> <touch file="foo">
|
---|
100 | <mapper type="glob" from="foo" to="bar" />
|
---|
101 | </touch>
|
---|
102 | </pre>
|
---|
103 | <p>creates <code>bar</code> if it doesn't exist and changes the
|
---|
104 | modification time to that of <code>foo</code>.</p>
|
---|
105 | <hr>
|
---|
106 | <p align="center">Copyright © 2000-2001,2003-2005 The Apache Software Foundation. All rights
|
---|
107 | Reserved.</p>
|
---|
108 |
|
---|
109 | </body>
|
---|
110 | </html>
|
---|