source: release-kits/lirk3/resources/gs3-release-maker/apache-ant-1.6.5/docs/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: 7.2 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<p><b>Since Ant 1.6.3</b>, the <i>file</i> attribute may be used to move
21(rename) an entire directory. If <i>tofile</i> denotes an existing file, or
22there is a directory by the same name in <i>todir</i>, the action will fail.
23</p>
24<h3>Parameters</h3>
25<table border="1" cellpadding="2" cellspacing="0">
26 <tr>
27 <td valign="top"><b>Attribute</b></td>
28 <td valign="top"><b>Description</b></td>
29 <td align="center" valign="top"><b>Required</b></td>
30 </tr>
31 <tr>
32 <td valign="top">file</td>
33 <td valign="top">the file or directory to move</td>
34 <td valign="top" align="center">One of <var>file</var> or
35 at least one nested fileset element</td>
36 </tr>
37 <tr>
38 <td valign="top">preservelastmodified</td>
39 <td valign="top">Give the moved files the same last modified
40 time as the original source files.
41 (<em>Note</em>: Ignored on Java 1.1)</td>
42 <td valign="top" align="center">No; defaults to false.</td>
43 </tr>
44 <tr>
45 <td valign="top">tofile</td>
46 <td valign="top">the file to move to</td>
47 <td valign="top" align="center" rowspan="2">With the <var>file</var> attribute,
48 either <var>tofile</var> or <var>todir</var> can be used. With nested filesets,
49 if the fileset size is greater than 1 or if the only entry in the fileset is a
50 directory or if the <var>file</var> attribute is already specified, only
51 <var>todir</var> is allowed</td>
52 </tr>
53 <tr>
54 <td valign="top">todir</td>
55 <td valign="top">the directory to move to</td>
56 </tr>
57 <tr>
58 <td valign="top">overwrite</td>
59 <td valign="top">overwrite existing files even if the destination
60 files are newer (default is &quot;true&quot;)</td>
61 <td valign="top" align="center">No</td>
62 </tr>
63 <tr>
64 <td valign="top">filtering</td>
65 <td valign="top">indicates whether token filtering should take place during
66 the move. See the <a href="filter.html">filter</a> task for a description of
67 how filters work.</td>
68 <td valign="top" align="center">No</td>
69 </tr>
70 <tr>
71 <td valign="top">flatten</td>
72 <td valign="top">ignore directory structure of source directory,
73 copy all files into a single directory, specified by the <var>todir</var>
74 attribute (default is &quot;false&quot;).Note that you can achieve the
75 same effect by using a <a href="../CoreTypes/mapper.html#flatten-mapper">flatten mapper</a></td>
76 <td valign="top" align="center">No</td>
77 </tr>
78 <tr>
79 <td valign="top">includeEmptyDirs</td>
80 <td valign="top">Copy empty directories included with the nested FileSet(s).
81 Defaults to &quot;yes&quot;.</td>
82 <td valign="top" align="center">No</td>
83 </tr>
84 <tr>
85 <td valign="top">failonerror</td>
86 <td valign="top">If false, log a warning message, but do not stop the
87 build, when the file to copy does not exist or one of the nested
88 filesets points to a directory that doesn't exist or an error occurs
89 while moving.
90 </td>
91 <td valign="top" align="center">No; defaults to true.</td>
92 </tr>
93 <tr>
94 <td valign="top">verbose</td>
95 <td valign="top">Log the files that are being moved.</td>
96 <td valign="top" align="center">No; defaults to false.</td>
97 </tr>
98 <tr>
99 <td valign="top">encoding</td>
100 <td valign="top">The encoding to assume when filter-copying the
101 files. <em>since Ant 1.5</em>.</td>
102 <td align="center">No - defaults to default JVM encoding</td>
103 </tr>
104 <tr>
105 <td valign="top">outputencoding</td>
106 <td valign="top">The encoding to use when writing the files.
107 <em>since Ant 1.6</em>.</td>
108 <td align="center">No - defaults to the value of the encoding
109 attribute if given or the default JVM encoding otherwise.</td>
110 </tr>
111 <tr>
112 <td valign="top">enablemultiplemapping</td>
113 <td valign="top">
114 If true the task will process to all the mappings for a
115 given source path. If false the task will only process
116 the first file or directory. This attribute is only relevant
117 if there is a mapper subelement.
118 <em>since Ant 1.6</em>.</td>
119 <td align="center">No - defaults to false.</td>
120 </tr>
121 <tr>
122 <td valign="top">granularity</td>
123 <td valign="top">The number of milliseconds leeway to give before
124 deciding a file is out of date. This is needed because not every
125 file system supports tracking the last modified time to the
126 millisecond level. Default is 0 milliseconds, or 2 seconds on DOS
127 systems. This can also be useful if source and target files live
128 on separate machines with clocks being out of sync. <em>since Ant
129 1.6</em>.</td>
130 </tr>
131</table>
132<h3>Parameters specified as nested elements</h3>
133<h4>mapper</h4>
134<p>You can define file name transformations by using a nested <a
135href="../CoreTypes/mapper.html">mapper</a> element. The default mapper used by
136<code>&lt;copy&gt;</code> is the <a
137href="../CoreTypes/mapper.html#identity-mapper">identity</a>.</p>
138<h4>filterchain</h4>
139<p>The Move task supports nested <a href="../CoreTypes/filterchain.html">
140FilterChain</a>s.</p>
141
142<p>
143If <code>&lt;filterset&gt;</code> and <code>&lt;filterchain&gt;</code> elements are used inside the
144same <code>&lt;move&gt;</code> task, all <code>&lt;filterchain&gt;</code> elements are processed first
145followed by <code>&lt;filterset&gt;</code> elements.
146</p>
147
148<h3>Examples</h3>
149<p><b>Move a single file (rename a file)</b></p>
150<pre>
151 &lt;move file=&quot;file.orig&quot; tofile=&quot;file.moved&quot;/&gt;
152</pre>
153<p><b>Move a single file to a directory</b></p>
154<pre>
155 &lt;move file=&quot;file.orig&quot; todir=&quot;dir/to/move/to&quot;/&gt;
156</pre>
157<p><b>Move a directory to a new directory</b></p>
158<pre>
159 &lt;move todir=&quot;new/dir/to/move/to&quot;&gt;
160 &lt;fileset dir=&quot;src/dir&quot;/&gt;
161 &lt;/move&gt;
162</pre>
163 <i>or, since Ant 1.6.3:</i>
164<pre>
165 &lt;move file=&quot;src/dir&quot; tofile=&quot;new/dir/to/move/to&quot;/&gt;
166</pre>
167<p><b>Move a set of files to a new directory</b></p>
168<pre>
169 &lt;move todir=&quot;some/new/dir&quot;&gt;
170 &lt;fileset dir=&quot;my/src/dir&quot;&gt;
171 &lt;include name=&quot;**/*.jar&quot;/&gt;
172 &lt;exclude name=&quot;**/ant.jar&quot;/&gt;
173 &lt;/fileset&gt;
174 &lt;/move&gt;
175</pre>
176<p><b>Append <code>&quot;.bak&quot;</code> to the names of all files
177in a directory.</b></p>
178<pre>
179 &lt;move todir=&quot;my/src/dir&quot; includeemptydirs=&quot;false&quot;&gt;
180 &lt;fileset dir=&quot;my/src/dir&quot;&gt;
181 &lt;exclude name=&quot;**/*.bak&quot;/&gt;
182 &lt;/fileset&gt;
183 &lt;mapper type=&quot;glob&quot; from=&quot;*&quot; to=&quot;*.bak&quot;/&gt;
184 &lt;/move&gt;
185</pre>
186<hr>
187<p align="center">Copyright &copy; 2000-2004 The Apache Software Foundation. All rights
188Reserved.</p>
189
190</body>
191</html>
192
Note: See TracBrowser for help on using the repository browser.