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).</p>
|
---|
17 | <p>For JDK 1.1 only the creation of new files with a modification time
|
---|
18 | of now works, all other cases will emit a warning.</p>
|
---|
19 | <h3>Parameters</h3>
|
---|
20 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
21 | <tr>
|
---|
22 | <td valign="top"><b>Attribute</b></td>
|
---|
23 | <td valign="top"><b>Description</b></td>
|
---|
24 | <td align="center" valign="top"><b>Required</b></td>
|
---|
25 | </tr>
|
---|
26 | <tr>
|
---|
27 | <td valign="top">file</td>
|
---|
28 | <td valign="top">the name of the file</td>
|
---|
29 | <td valign="top" align="center">unless a nested fileset element
|
---|
30 | has been specified.</td>
|
---|
31 | </tr>
|
---|
32 | <tr>
|
---|
33 | <td valign="top">millis</td>
|
---|
34 | <td valign="top">specifies the new modification time of the file
|
---|
35 | in milliseconds since midnight Jan 1 1970</td>
|
---|
36 | <td valign="top" align="center">No</td>
|
---|
37 | </tr>
|
---|
38 | <tr>
|
---|
39 | <td valign="top">datetime</td>
|
---|
40 | <td valign="top">specifies the new modification time of the file
|
---|
41 | in the format MM/DD/YYYY HH:MM AM_or_PM or MM/DD/YYYY HH:MM:SS AM_or_PM.</td>
|
---|
42 | <td valign="top" align="center">No</td>
|
---|
43 | </tr>
|
---|
44 | </table>
|
---|
45 | <p>If both <code>millis</code> and <code>datetime</code> are omitted
|
---|
46 | the current time is assumed.</p>
|
---|
47 | <h3>Examples</h3>
|
---|
48 | <pre> <touch file="myfile"/></pre>
|
---|
49 | <p>creates <code>myfile</code> if it doesn't exist and changes the
|
---|
50 | modification time to the current time.</p>
|
---|
51 | <pre> <touch file="myfile" datetime="06/28/2000 2:02 pm"/></pre>
|
---|
52 | <p>creates <code>myfile</code> if it doesn't exist and changes the
|
---|
53 | modification time to Jun, 28 2000 2:02 pm (14:02 for those used to 24
|
---|
54 | hour times).</p>
|
---|
55 | <pre> <touch datetime="09/10/1974 4:30 pm">
|
---|
56 | <fileset dir="src_dir"/>
|
---|
57 | </touch></pre>
|
---|
58 | <p>changes the modification time to Oct, 09 1974 4:30 pm of all files and directories
|
---|
59 | found in <code>src_dir</code>. </p>
|
---|
60 | <pre> <touch file="myfile" datetime="06/28/2000 2:02:17 pm"/></pre>
|
---|
61 | <p>creates <code>myfile</code> if it doesn't exist and changes the
|
---|
62 | modification time to Jun, 28 2000 2:02:17 pm (14:02:17 for those used to 24
|
---|
63 | hour times), if the filesystem allows a precision of one second - a
|
---|
64 | time close to it otherwise.</p>
|
---|
65 | <hr>
|
---|
66 | <p align="center">Copyright © 2000-2001,2003 Apache Software Foundation. All rights
|
---|
67 | Reserved.</p>
|
---|
68 |
|
---|
69 | </body>
|
---|
70 | </html>
|
---|
71 |
|
---|