Returns a bool indicating whether the specified directory exists.
- path
- A string containing the name of the directory to check.
true if the caller has the required permissions and path contains the name of an existing directory; otherwise, false. If path is null, a zero-length string, or contains the name of a file, returns false.
Type Reason System.Security.Permissions.FileIOPermission Requires permission to read the specified directory. See System.Security.Permissions.FileIOPermissionAccess.Read.
Type Reason ArgumentException path is a zero-length string, contains only white space, or contains one or more implementation-defined invalid characters. System.IO.PathTooLongException The length of path or the absolute path information for path exceeds the system-defined maximum length. System.IO.DirectoryNotFoundException path was not found.
If the caller does not have sufficient permissions to read the files in the directory specified by path, no exception is thrown and the method returns false regardless of the existence of path.
The path argument is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory.
Note: To obtain the current working directory, see Directory.GetCurrentDirectory.
Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0