source: release-kits/lirk3/bin/ant-installer/web/manual1.6.2/manual/CoreTasks/move.html@ 14982

Last change on this file since 14982 was 14982, checked in by oranfry, 16 years ago

initial import of LiRK3

File size: 6.3 KB
Line 
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
14a new directory. By default, the
15destination file is overwritten if it already exists. When <var>overwrite</var> is
16turned off, then files are only moved if the source file is newer than
17the 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
19to 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 &quot;true&quot;)</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 &quot;false&quot;).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 &quot;yes&quot;.</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
121href="../CoreTypes/mapper.html">mapper</a> element. The default mapper used by
122<code>&lt;copy&gt;</code> is the <a
123href="../CoreTypes/mapper.html#identity-mapper">identity</a>.</p>
124<h4>filterchain</h4>
125<p>The Move task supports nested <a href="../CoreTypes/filterchain.html">
126FilterChain</a>s.</p>
127
128<p>
129If &lt;filterset&gt; and &lt;filterchain&gt; elements are used inside the
130same &lt;move&gt; task, all &lt;filterchain&gt; elements are processed first
131followed by &lt;filterset&gt; elements.
132</p>
133
134<h3>Examples</h3>
135<p><b>Move a single file (rename a file)</b></p>
136<pre>
137 &lt;move file=&quot;file.orig&quot; tofile=&quot;file.moved&quot;/&gt;
138</pre>
139<p><b>Move a single file to a directory</b></p>
140<pre>
141 &lt;move file=&quot;file.orig&quot; todir=&quot;dir/to/move/to&quot;/&gt;
142</pre>
143<p><b>Move a directory to a new directory</b></p>
144<pre>
145 &lt;move todir=&quot;new/dir/to/move/to&quot;&gt;
146 &lt;fileset dir=&quot;src/dir&quot;/&gt;
147 &lt;/move&gt;
148</pre>
149<p><b>Move a set of files to a new directory</b></p>
150<pre>
151 &lt;move todir=&quot;some/new/dir&quot;&gt;
152 &lt;fileset dir=&quot;my/src/dir&quot;&gt;
153 &lt;include name=&quot;**/*.jar&quot;/&gt;
154 &lt;exclude name=&quot;**/ant.jar&quot;/&gt;
155 &lt;/fileset&gt;
156 &lt;/move&gt;
157</pre>
158<p><b>Append <code>&quot;.bak&quot;</code> to the names of all files
159in a directory.</b></p>
160<pre>
161 &lt;move todir=&quot;my/src/dir&quot; includeemptydirs=&quot;false&quot;&gt;
162 &lt;fileset dir=&quot;my/src/dir&quot;&gt;
163 &lt;exclude name=&quot;**/*.bak&quot;/&gt;
164 &lt;/fileset&gt;
165 &lt;mapper type=&quot;glob&quot; from=&quot;*&quot; to=&quot;*.bak&quot;/&gt;
166 &lt;/move&gt;
167</pre>
168<hr>
169<p align="center">Copyright &copy; 2000-2004 The Apache Software Foundation. All rights
170Reserved.</p>
171
172</body>
173</html>
174
Note: See TracBrowser for help on using the repository browser.