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