NAnt
![]() ![]() ![]() |
v0.85-rc2 |
[This is preliminary documentation and subject to change.]
Deletes a file, fileset or directory.
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.
Note: If the file
attribute is set then the fileset contents will be ignored. To delete the files in the fileset ommit the file
attribute in the <delete>
element.
Note: Read-only files cannot be deleted. Use the <attrib> task first to remove the read-only attribute.
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 <fileset>. The default is true. | 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 |
Delete a single file.
<delete file="myfile.txt" />
Delete a directory and the contents within. If the directory does not exist, the task does nothing.
<delete dir="${build.dir}" failonerror="false" />
Delete a set of files. Note the lack of file
attribute in the <delete>
element.
<delete> <fileset> <include name="${basename}-??.exe" /> <include name="${basename}-??.pdb" /> </fileset> </delete>