Mono Class Library: Mono.Unix.UnixDirectoryInfo Overview | Members

Mono.Unix.UnixDirectoryInfo.Delete Method

Deletes UnixFileSystemInfo.FullName and, if indicated, removes all files and directories within Deletes UnixFileSystemInfo.FullName.

public void Delete (bool recursive)

See Also

Native.rmdir

Parameters

recursive
Specify true to delete all files and sub-directories in UnixFileSystemInfo.FullName; otherwise, specify false.

Exceptions

TypeReason
InvalidOperationException

The filesystem containing UnixFileSystemInfo.FullName does not support the removal of file system entries. [Mono.Unix.Native.Errno.EPERM]

-or-

The directory containing UnixFileSystemInfo.FullName has the FileSpecialAttributes.Sticky bit set and the process's UnixEnvironment.EffectiveUserId is neither the uid of the file to be deleted nor that of the directory containing it. [Mono.Unix.Native.Errno.EPERM]

UnauthorizedAccessException

Write access to the directory containing UnixFileSystemInfo.FullName was not allowed for the processe's effective user id UnixEnvironment.EffectiveUserId. [Mono.Unix.Native.Errno.EACCESS]

-or-

One of the directories in UnixFileSystemInfo.FullName did not have search (execute) permissions. [Mono.Unix.Native.Errno.EACCESS]

System.IO.DirectoryNotFoundException A component of UnixFileSystemInfo.FullName is not a directory. [Mono.Unix.Native.Errno.ENOTDIR]
System.IO.FileNotFoundExceptionUnixFileSystemInfo.FullName does not exist. [Mono.Unix.Native.Errno.ENOENT]
System.IO.IOException

UnixFileSystemInfo.FullName contains files other than '.' and '..' in it. [Mono.Unix.Native.Errno.ENOTEMPTY]

-or-

An I/O error occurred while deleting the file system entry or deallocating the inode. [Mono.Unix.Native.Errno.EIO]

-or-

The directory entry to be removed resides in a read-only file system. [Mono.Unix.Native.Errno.EROFS]

System.IO.PathTooLongExceptionUnixFileSystemInfo.FullName was too long. [Mono.Unix.Native.Errno.ENAMETOOLONG]
Mono.Unix.UnixIOException

Too many symbolic links were encountered in translating UnixFileSystemInfo.FullName. [Mono.Unix.Native.Errno.ELOOP]

-or-

The directory to be removed is the mount point for a mounted filesystem. [Mono.Unix.Native.Errno.EBUSY]

Remarks

false is the default value for the recursive parameter. Thus, UnixFileSystemInfo.Delete is not a recursive delete.

Requirements

Namespace: Mono.Unix
Assembly: Mono.Posix (in Mono.Posix.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0