Mega Code Archive

 
Categories / C# / File Stream
 

File Exists Determines whether the specified file exists

using System;     using System.IO;     using System.Security.AccessControl;     class FileExample     {         public static void Main()         {             string curFile = @"c:\test.txt";             Console.WriteLine(File.Exists(curFile) ? "File exists." : "File does not exist.");         }     }