How to check whether folder is present in the drive or not?

 Posted by Vishalneeraj-24503 on 2/4/2015 | Category: ASP.NET Interview questions | Views: 472 | Points: 40
Answer:

We have Exist static method of File class, which comes under System.IO namespace, so we can check whether folder is present in the drive or not.

Exist returns True/False values.

Using System.IO;
if(File.Exist("Path_of_folder"))
{
Response.Write("File Exists");
}
else
{
Response.Write("File does not Exist");
}


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response