NAnt SDK Documentation - v0.85-nightly-2005-11-09

MoveTask Class

[This is preliminary documentation and subject to change.]

Moves a file or set of files to a new file or directory.

For a list of all members of this type, see MoveTask Members.

System.Object
   NAnt.Core.Element
      NAnt.Core.Task
         NAnt.Core.Tasks.CopyTask
            NAnt.Core.Tasks.MoveTask

[Visual Basic]
<TaskName(Name:="move")>
Public Class MoveTask
    Inherits CopyTask
[C#]
[TaskName(Name="move")]
public class MoveTask : CopyTask

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

Files are only moved if the source file is newer than the destination file, or if the destination file does not exist. However, you can explicitly overwrite files with the Overwrite attribute.

A FileSet can be used to select files to move. To use a FileSet, the ToDirectory attribute must be set.

Encoding

Unless an encoding is specified, the encoding associated with the system's current ANSI code page is used.

An UTF-8, little-endian Unicode, and big-endian Unicode encoded text file is automatically recognized, if the file starts with the appropriate byte order marks.

Note    If you employ filters in your move operation, you should limit the move to text files. Binary files will be corrupted by the move operation.

Example

Move a single file while changing its encoding from "latin1" to "utf-8".

    
<move
    file="myfile.txt"
    tofile="mycopy.txt"
    inputencoding="latin1"
    outputencoding="utf-8" />
    
  

Move a set of files.

    
<move todir="${build.dir}">
    <fileset basedir="bin">
        <include name="*.dll" />
    </fileset>
</move>
    
  

Move a set of files to a directory, replacing @TITLE@ with "Foo Bar" in all files.

    
<move todir="../backup/dir">
    <fileset basedir="src_dir">
        <include name="**/*" />
    </fileset>
    <filterchain>
        <replacetokens>
            <token key="TITLE" value="Foo Bar" />
        </replacetokens>
    </filterchain>
</move>
    
  

Requirements

Namespace: NAnt.Core.Tasks

Assembly: NAnt.Core (in NAnt.Core.dll)

See Also

MoveTask Members | NAnt.Core.Tasks Namespace