Directory Exists - CSharp System.IO

CSharp examples for System.IO:DirectoryInfo

Description

Directory Exists

Demo Code


using System.Security.Cryptography;
using System.IO;/*w w  w  .  j  a v a 2s .  co m*/
using System.Text;
using System.Collections.Generic;
using System;

public class Main{
        public static bool DirectoryExists(string directoryFullPath)
      {
         System.IO.DirectoryInfo drInfo = null;

         try
         {
            drInfo = new System.IO.DirectoryInfo(directoryFullPath);

            return drInfo.Exists;
         }

         catch (Exception ex)
         {

            return false;
         }
      }
}

Related Tutorials