Directory.Exists Method (String)
Determines whether the given path refers to an existing directory on disk.
Assembly: mscorlib (in mscorlib.dll)
The path to test.
Return ValueType: System.Boolean
true if path refers to an existing directory; false if the directory does not exist or an error occurs when trying to determine if the specified directory exists.
The path parameter is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory.
Trailing spaces are removed from the end of the path parameter before checking whether the directory exists.
The path parameter is not case-sensitive.
If you do not have at a minimum read-only permission to the directory, themethod will return false.
Themethod returns false if any error occurs while trying to determine if the specified file exists. This can occur in situations that raise exceptions such as passing a file name with invalid characters or too many characters, a failing or missing disk, or if the caller does not have permission to read the file.
Available since 10
Available since 1.1
Available since 2.0
Windows Phone Silverlight
Available since 7.0