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