NAnt
![]() ![]() ![]() |
v0.85 |
[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.
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 |
todir
attribute must be set. Copy a single file.
<copy file="myfile.txt" tofile="mycopy.txt" />
Copy a set of files to a new directory.
<copy todir="${build.dir}"> <fileset basedir="bin"> <includes name="*.dll" /> </fileset> </copy>