softairhk

softairhk

  • NA
  • 115
  • 0

How to delete files?

Nov 13 2003 1:42 AM
Hello! I would like to know how to delete files? I know the following coding can do copy directory and files, so how to modify it to delete files. public static void copyDirectory(string Src,string Dst) { String[] Files; if(Dst[Dst.Length-1]!=Path.DirectorySeparatorChar) Dst+=Path.DirectorySeparatorChar; if(!Directory.Exists(Dst)) Directory.CreateDirectory(Dst); Files=Directory.GetFileSystemEntries(Src); foreach(string Element in Files) { // Sub directories if(Directory.Exists(Element)) copyDirectory(Element,Dst+Path.GetFileName(Element)); // Files in directory else File.Copy(Element,Dst+Path.GetFileName(Element),true); } }

Answers (1)