Question: how to check if any file exists in a directory in c#?
Answer: string fileName = @ "c:\temp\Mahesh.txt"; if (File.Exists(fileName)) Console.WriteLine("File exists." ); else. Console. ...  After that check whether the file exists in a directory or not. if(File.Exists(@ "D:\myfile.txt")) { Console.WriteLine("The file exists."