Loading ...

How to check directory exists | CodeAsp.Net

How to check directory exists

 /5
0 (0votes)

In this blog I will explain how check a directory exists or not.I have used

Directory class Exists method to explain it.Below is the code snippet.

using System;

using System.IO;

namespace ConsoleApplication1

{

class Program

{

static void Main(string[] args)

{

bool folderExists = Directory.Exists(@"c:\windows");

}

}

}

Above i have passed c:\windows as path to check whether it exists or not

If it exists it will return true else false.

Happy Reading.!

 

 

Comments (no comments yet)

Top Posts