Question: how to check if a file exists in a directory 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."