B.23 MoveTask
Prev | Appendix B. Core tasks | Next

## B.23 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.23.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.23.2 Attributes and Nested Elements

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

Prev | Up | Next
B.22 MkdirTask | Home | B.24 PhingTask