how to check the files are exist or not in a floder
-
plz any ine help me i need a code for finding whether a file is exisisting in the folder if exist display the file woth some text or not create the file with some text and displaying message that file is created successfully using c#
-
plz any ine help me i need a code for finding whether a file is exisisting in the folder if exist display the file woth some text or not create the file with some text and displaying message that file is created successfully using c#
you can use
System.IO.File.Exists(string path)
method to check whether the file exists or not. good luck -
plz any ine help me i need a code for finding whether a file is exisisting in the folder if exist display the file woth some text or not create the file with some text and displaying message that file is created successfully using c#
using System; using System.IO; using System.Collections; public class FileHandling { public static void Main(string[] args) { foreach(string path in args) { if(File.Exists(path)) { // Your code should run here } else if(Directory.Exists(path)) { //Your code should run here } else { Console.WriteLine("{0} is not a valid file or directory"); } } } Happy Programming ----- Abhijit