<copy>

[This is preliminary documentation and subject to change.]

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

Files are only copied 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 copy. To use a <fileset>, the todir attribute must be set.

Parameters

Attribute Type Description Required
file file The file to copy. False
flatten bool Ignore directory structure of source directory, copy all files into a single directory, specified by the todir attribute. The default is false. False
includeemptydirs bool Copy any empty directories included in the <fileset>. The default is true. False
overwrite bool Overwrite existing files even if the destination files are newer. The default is false. False
todir directory The directory to copy to. False
tofile file The file to copy to. False
failonerror bool Determines if task failure stops the build, or is just reported. The default is true. False
if bool If true then the task will be executed; otherwise, skipped. The default is true. False
unless bool Opposite of if. If false then the task will be executed; otherwise, skipped. The default is false. False
verbose bool Determines whether the task should report detailed build log messages. The default is false. False

Nested Elements:

<fileset>

Used to select the files to copy. To use a <fileset>, the todir attribute must be set.

</fileset>

<filterchain>

The filterchain definition to use when filter-copying the files.

</filterchain>

Examples

Requirements

Assembly: NAnt.Core (0.85.1698.0)