Deletes either a single file, all files in a specified directory and its sub-directories, or a set of files specified by one or more filesets.
If the NAnt.Core.Tasks.DeleteTask.File
or NAnt.Core.Tasks.DeleteTask.Directory
attribute is
set then the fileset contents will be ignored. To delete the files
in the fileset omit the NAnt.Core.Tasks.DeleteTask.File
and NAnt.Core.Tasks.DeleteTask.Directory
attributes in the <delete>
element.
If the specified file or directory does not exist, no error is reported.
NAnt.Core.Tasks.AttribTask
first to remove the read-only attribute.
Parameters
Attribute | Type | Description | Required |
---|---|---|---|
dir | directory |
The directory to delete.
|
False |
file | file |
The file to delete.
|
False |
includeemptydirs | bool |
Remove any empty directories included in the
NAnt.Core.Types.FileSet .
The default is true .
|
False |
verbose | bool |
Controls whether to show the name of each deleted file or directory.
The default is
false .
|
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
NAnt.Core.Task.IfDefined . 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
Examples
Delete a single file.
<delete file="myfile.txt" />
Delete a directory and the contents within. If the directory does not exist, no error is reported.
<delete dir="${build.dir}" />
Delete a set of files.
<delete>
<fileset>
<include name="${basename}-??.exe" />
<include name="${basename}-??.pdb" />
</fileset>
</delete>
Requirements
- Assembly
- NAnt
.Core .dll - Namespace
-
NAnt
.Core .Tasks