Answers for "c# if folder exists"

C#
4

c# check if a directory exists

string directory = @"C:\folder name";
  
	if (Directory.Exists(directory)
    {
    	// Directory exits!
    }
Posted by: Guest on October-20-2020
0

c# if folder exists

void CheckFolderExist(string path)
        {
            try
            {
                bool exists = Directory.Exists(path);
                if (!exists)
                {
                   //if folder doesnt exist
                }
                else if (exists)
                {
                    //if folder does exist
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName);
            }
        }
Posted by: Guest on October-07-2021

C# Answers by Framework

Browse Popular Code Answers by Language