<delete>

[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.

If the file or dir attribute is set then the fileset contents will be ignored. To delete the files in the fileset ommit the file and dir attributes in the <delete> element.

If the specified file or directory does not exist, no error is reported.

Note: Read-only files cannot be deleted. Use the <attrib> task 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 <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 if. If false then the task will be executed; otherwise, skipped. The default is false. False

Nested Elements:

<fileset>

All the files in the file set will be deleted.

</fileset>

Examples

Requirements

Assembly: NAnt.Core (0.91.3951.0)