ディレクトリ(フォルダ)が存在するかチェックする

C#

System.IO.Directory.Exists(ディレクトリパス)

System.IO.DirectoryクラスのExists 静的メソッドを利用することでディレクトリ(フォルダ)が存在するかチェックすることができます。
ディレクトリ(フォルダ)が存在していたら true 、存在しなければ false を返します。

使用例
            string directoryPath = @"C:\Users";
            if (System.IO.Directory.Exists(directoryPath))
            {
                Console.WriteLine($"{directoryPath} ディレクトリあり");
            }
            else
            {
                Console.WriteLine($"{directoryPath} ディレクトリなし");
            }