B.36 MoveTask

Moves a file or directory to a new file or directory. By default, the destination file is overwritten if it already exists. When overwrite is turned off, then files are only moved if the source file is newer than the destination file, or when the destination file does not exist.

Source files and directories are only deleted if the file or directory has been copied to the destination successfully.

B.36.1 Examples

<!-- The following will move the file "somefile.txt" to "/tmp" and
change its filename to "anotherfile.bak". It will overwrite
an existing file. -->
<move file="somefile.txt" tofile="/tmp/anotherfile.bak" overwrite="true"/>

<!-- This will move the "/tmp" directory to "/home/default/tmp",
preserving the directory name. So the final name is
"/home/default/tmp/tmp". Empty directories are also copied -->
<move file="/tmp" todir="/home/default/tmp" includeemptydirs="true"/>

B.36.2 Attributes and Nested Elements

For further documentation, seeSection B.14, “CopyTask”, since MoveTask only is a child of CopyTask and inherits all attributes.