System.IO.DirectoryInfo.Delete Method

Deletes this instance of a System.IO.DirectoryInfo, specifying whether to delete subdirectories and files.

Syntax

public void Delete (bool recursive)

Parameters

recursive
true to delete this directory, its subdirectories, and all files; otherwise, false.

Remarks

If the DirectoryInfo has no files or subdirectories, this method deletes the DirectoryInfo even if recursive is false. Attempting to delete a DirectoryInfo that is not empty when recursive is false throws an System.IO.IOException.

For a list of common I/O tasks, see Common I/O Tasks.

Requirements

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0