![]() |
VOOZH | about |
Given a directory, now our task is to check given directory exists or not. So to this task, we use the Exists() method of the Directory class. This method will return true if the given directory exists, otherwise false.
Syntax:
public static bool Exists (string? Mypath);
Where, Mypath is a parameter of Exists() method of string type. It represents the location or path of the specified directory. Now the Exists method will return true if the given path refers to the existing directory otherwise it will return false.
Return Type: The return type of this method is a boolean that is either true or false. This method will return true if the given Mypath refers to the existing directory otherwise it will return false.
Example 1:
Output:
The Specified directory Exists
Example 2:
Output:
Not Exist