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.

move.html 5.8 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Move Task</title>
  5. </head>
  6. <body>
  7. <h2><a name="move">Move</a></h2>
  8. <h3>Description</h3>
  9. <p>Moves a file to a new file or directory, or sets of files to
  10. a new directory. By default, the
  11. destination file is overwritten if it already exists. When <var>overwrite</var> is
  12. turned off, then files are only moved if the source file is newer than
  13. the destination file, or when the destination file does not exist.</p>
  14. <p><a href="../CoreTypes/fileset.html">FileSet</a>s are used to select sets of files
  15. to move to the <var>todir</var> directory.</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 file to move</td>
  26. <td valign="top" align="center">One of <var>file</var> or
  27. at least one nested fileset element</td>
  28. </tr>
  29. <tr>
  30. <td valign="top">preservelastmodified</td>
  31. <td valign="top">Give the moved files the same last modified
  32. time as the original source files.
  33. (<em>Note</em>: Ignored on Java 1.1)</td>
  34. <td valign="top" align="center">No; defaults to false.</td>
  35. </tr>
  36. <tr>
  37. <td valign="top">tofile</td>
  38. <td valign="top">the file to move to</td>
  39. <td valign="top" align="center" rowspan="2">With the <var>file</var> attribute,
  40. either <var>tofile</var> or <var>todir</var> can be used. With nested filesets,
  41. if the fileset size is greater than 1 or if the only entry in the fileset is a
  42. directory or if the <var>file</var> attribute is already specified, only
  43. <var>todir</var> is allowed</td>
  44. </tr>
  45. <tr>
  46. <td valign="top">todir</td>
  47. <td valign="top">the directory to move to</td>
  48. </tr>
  49. <tr>
  50. <td valign="top">overwrite</td>
  51. <td valign="top">overwrite existing files even if the destination
  52. files are newer (default is &quot;true&quot;)</td>
  53. <td valign="top" align="center">No</td>
  54. </tr>
  55. <tr>
  56. <td valign="top">filtering</td>
  57. <td valign="top">indicates whether token filtering should take place during
  58. the move. See the <a href="filter.html">filter</a> task for a description of
  59. how filters work.</td>
  60. <td valign="top" align="center">No</td>
  61. </tr>
  62. <tr>
  63. <td valign="top">flatten</td>
  64. <td valign="top">ignore directory structure of source directory,
  65. copy all files into a single directory, specified by the <var>todir</var>
  66. attribute (default is &quot;false&quot;).Note that you can achieve the
  67. same effect by using a <a href="../CoreTypes/mapper.html#flatten-mapper">flatten mapper</a></td>
  68. <td valign="top" align="center">No</td>
  69. </tr>
  70. <tr>
  71. <td valign="top">includeEmptyDirs</td>
  72. <td valign="top">Copy empty directories included with the nested FileSet(s).
  73. Defaults to &quot;yes&quot;.</td>
  74. <td valign="top" align="center">No</td>
  75. </tr>
  76. <tr>
  77. <td valign="top">failonerror</td>
  78. <td valign="top">Log a warning message, but do not stop the build,
  79. when the file to move does not exist.
  80. Only meaningful when moving a single file.
  81. </td>
  82. <td valign="top" align="center">No; defaults to true.</td>
  83. </tr>
  84. <tr>
  85. <td valign="top">verbose</td>
  86. <td valign="top">Log the files that are being moved.</td>
  87. <td valign="top" align="center">No; defaults to false.</td>
  88. </tr>
  89. <tr>
  90. <td valign="top">encoding</td>
  91. <td valign="top">The encoding to assume when filter-copying the
  92. files. <em>since Ant 1.5</em>.</td>
  93. <td align="center">No - defaults to default JVM encoding</td>
  94. </tr>
  95. <tr>
  96. <td valign="top">outputencoding</td>
  97. <td valign="top">The encoding to use when writing the files.
  98. <em>since Ant 1.6</em>.</td>
  99. <td align="center">No - defaults to the value of the encoding
  100. attribute if given or the default JVM encoding otherwise.</td>
  101. </tr>
  102. </table>
  103. <h3>Parameters specified as nested elements</h3>
  104. <h4>mapper</h4>
  105. <p>You can define file name transformations by using a nested <a
  106. href="../CoreTypes/mapper.html">mapper</a> element. The default mapper used by
  107. <code>&lt;copy&gt;</code> is the <a
  108. href="../CoreTypes/mapper.html#identity-mapper">identity</a>.</p>
  109. <h4>filterchain</h4>
  110. <p>The Move task supports nested <a href="../CoreTypes/filterchain.html">
  111. FilterChain</a>s.</p>
  112. <p>
  113. If &lt;filterset&gt; and &lt;filterchain&gt; elements are used inside the
  114. same &lt;move&gt; task, all &lt;filterchain&gt; elements are processed first
  115. followed by &lt;filterset&gt; elements.
  116. </p>
  117. <h3>Examples</h3>
  118. <p><b>Move a single file (rename a file)</b></p>
  119. <pre>
  120. &lt;move file=&quot;file.orig&quot; tofile=&quot;file.moved&quot;/&gt;
  121. </pre>
  122. <p><b>Move a single file to a directory</b></p>
  123. <pre>
  124. &lt;move file=&quot;file.orig&quot; todir=&quot;dir/to/move/to&quot;/&gt;
  125. </pre>
  126. <p><b>Move a directory to a new directory</b></p>
  127. <pre>
  128. &lt;move todir=&quot;new/dir/to/move/to&quot;&gt;
  129. &lt;fileset dir=&quot;src/dir&quot;/&gt;
  130. &lt;/move&gt;
  131. </pre>
  132. <p><b>Move a set of files to a new directory</b></p>
  133. <pre>
  134. &lt;move todir=&quot;some/new/dir&quot;&gt;
  135. &lt;fileset dir=&quot;my/src/dir&quot;&gt;
  136. &lt;include name=&quot;**/*.jar&quot;/&gt;
  137. &lt;exclude name=&quot;**/ant.jar&quot;/&gt;
  138. &lt;/fileset&gt;
  139. &lt;/move&gt;
  140. </pre>
  141. <p><b>Append <code>&quot;.bak&quot;</code> to the names of all files
  142. in a directory.</b></p>
  143. <pre>
  144. &lt;move todir=&quot;my/src/dir&quot;&gt;
  145. &lt;fileset dir=&quot;my/src/dir&quot;&gt;
  146. &lt;exclude name=&quot;**/*.bak&quot;/&gt;
  147. &lt;/fileset&gt;
  148. &lt;mapper type=&quot;glob&quot; from=&quot;*&quot; to=&quot;*.bak&quot;/&gt;
  149. &lt;/move&gt;
  150. </pre>
  151. <hr>
  152. <p align="center">Copyright &copy; 2000-2003 Apache Software Foundation. All rights
  153. Reserved.</p>
  154. </body>
  155. </html>