You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

touch.html 2.7 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Touch Task</title>
  5. </head>
  6. <body>
  7. <h2><a name="touch">Touch</a></h2>
  8. <h3>Description</h3>
  9. <p>Changes the modification time of a file and possibly creates it at
  10. the same time. In addition to working with a single file, this Task
  11. can also work a <a href="../CoreTypes/fileset.html">Fileset</a> (which
  12. also includes directories)
  13. or a <a href="../CoreTypes/filelist.html">Filelist</a> (since Ant 1.6).</p>
  14. <p>For JDK 1.1 only the creation of new files with a modification time
  15. of now works, all other cases will emit a warning.</p>
  16. <h3>Parameters</h3>
  17. <table border="1" cellpadding="2" cellspacing="0">
  18. <tr>
  19. <td valign="top"><b>Attribute</b></td>
  20. <td valign="top"><b>Description</b></td>
  21. <td align="center" valign="top"><b>Required</b></td>
  22. </tr>
  23. <tr>
  24. <td valign="top">file</td>
  25. <td valign="top">the name of the file</td>
  26. <td valign="top" align="center">unless a nested fileset element
  27. or a nested filelist element
  28. has been specified.</td>
  29. </tr>
  30. <tr>
  31. <td valign="top">millis</td>
  32. <td valign="top">specifies the new modification time of the file
  33. in milliseconds since midnight Jan 1 1970</td>
  34. <td valign="top" align="center">No</td>
  35. </tr>
  36. <tr>
  37. <td valign="top">datetime</td>
  38. <td valign="top">specifies the new modification time of the file
  39. in the format MM/DD/YYYY HH:MM AM_or_PM or MM/DD/YYYY HH:MM:SS AM_or_PM.</td>
  40. <td valign="top" align="center">No</td>
  41. </tr>
  42. </table>
  43. <p>If both <code>millis</code> and <code>datetime</code> are omitted
  44. the current time is assumed.</p>
  45. <h3>Examples</h3>
  46. <pre> &lt;touch file=&quot;myfile&quot;/&gt;</pre>
  47. <p>creates <code>myfile</code> if it doesn't exist and changes the
  48. modification time to the current time.</p>
  49. <pre> &lt;touch file=&quot;myfile&quot; datetime=&quot;06/28/2000 2:02 pm&quot;/&gt;</pre>
  50. <p>creates <code>myfile</code> if it doesn't exist and changes the
  51. modification time to Jun, 28 2000 2:02 pm (14:02 for those used to 24
  52. hour times).</p>
  53. <pre> &lt;touch datetime=&quot;09/10/1974 4:30 pm&quot;&gt;
  54. &lt;fileset dir=&quot;src_dir&quot;/&gt;
  55. &lt;/touch&gt;</pre>
  56. <p>changes the modification time to Oct, 09 1974 4:30 pm of all files and directories
  57. found in <code>src_dir</code>. </p>
  58. <pre> &lt;touch file=&quot;myfile&quot; datetime=&quot;06/28/2000 2:02:17 pm&quot;/&gt;</pre>
  59. <p>creates <code>myfile</code> if it doesn't exist and changes the
  60. modification time to Jun, 28 2000 2:02:17 pm (14:02:17 for those used to 24
  61. hour times), if the filesystem allows a precision of one second - a
  62. time close to it otherwise.</p>
  63. <hr>
  64. <p align="center">Copyright &copy; 2000-2001,2003-2004 The Apache Software Foundation. All rights
  65. Reserved.</p>
  66. </body>
  67. </html>