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

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

Parameters

recursive
Type: SystemBoolean
to delete this directory, its subdirectories, and all files; otherwise, .
ignoreReadOnly
Type: SystemBoolean
ignores read only attribute of files and directories.
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