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.3 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Ant User Manual</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).</p>
  13. <p>For JDK 1.1 only the creation of new files with a modification time
  14. of now works, all other cases will emit a warning.</p>
  15. <h3>Parameters</h3>
  16. <table border="1" cellpadding="2" cellspacing="0">
  17. <tr>
  18. <td valign="top"><b>Attribute</b></td>
  19. <td valign="top"><b>Description</b></td>
  20. <td align="center" valign="top"><b>Required</b></td>
  21. </tr>
  22. <tr>
  23. <td valign="top">file</td>
  24. <td valign="top">the name of the file</td>
  25. <td valign="top" align="center">unless a nested fileset element
  26. has been specified.</td>
  27. </tr>
  28. <tr>
  29. <td valign="top">millis</td>
  30. <td valign="top">specifies the new modification time of the file
  31. in milliseconds since midnight Jan 1 1970</td>
  32. <td valign="top" align="center">No</td>
  33. </tr>
  34. <tr>
  35. <td valign="top">datetime</td>
  36. <td valign="top">specifies the new modification time of the file
  37. in the format MM/DD/YYYY HH:MM AM_or_PM.</td>
  38. <td valign="top" align="center">No</td>
  39. </tr>
  40. </table>
  41. <p>If both <code>millis</code> and <code>datetime</code> are omitted
  42. the current time is assumed.</p>
  43. <h3>Examples</h3>
  44. <pre> &lt;touch file=&quot;myfile&quot;/&gt;</pre>
  45. <p>creates <code>myfile</code> if it doesn't exist and changes the
  46. modification time to the current time.</p>
  47. <pre> &lt;touch file=&quot;myfile&quot; datetime=&quot;06/28/2000 2:02 pm&quot;/&gt;</pre>
  48. <p>creates <code>myfile</code> if it doesn't exist and changes the
  49. modification time to Jun, 28 2000 2:02 pm (14:02 for those used to 24
  50. hour times).</p>
  51. <pre> &lt;touch datetime=&quot;09/10/1974 4:30 pm&quot;&gt;
  52. &lt;fileset dir=&quot;src_dir&quot;/&gt;
  53. &lt;/touch&gt;</pre>
  54. <p>changes the modification time to Oct, 09 1974 4:30 pm of all files and directories
  55. found in <code>src_dir</code>. </p>
  56. <hr>
  57. <p align="center">Copyright &copy; 2000,2001 Apache Software Foundation. All rights
  58. Reserved.</p>
  59. </body>
  60. </html>