DirectoryInfo.Delete Method (Boolean)
Click or drag to resize
DirectoryInfoDelete Method (Boolean)
Deletes this instance of a DirectoryInfo, specifying whether to delete subdirectories and files.

Namespace: Alphaleonis.Win32.Filesystem
Assembly: AlphaFS (in AlphaFS.dll) Version: 2.0
Syntax
public void Delete(
	bool recursive
)

Parameters

recursive
Type: SystemBoolean
to delete this directory, its subdirectories, and all files; otherwise, .
Exceptions
ExceptionCondition
ArgumentExceptionThe path parameter contains invalid characters, is empty, or contains only white spaces.
ArgumentNullException
DirectoryNotFoundException
Remarks

If the DirectoryInfo has no files or subdirectories, this method deletes the DirectoryInfo even if recursive is .

Attempting to delete a DirectoryInfo that is not empty when recursive is false throws an IOException.

See Also