CSharp examples for System.IO:File Copy
Copy File
using System.Threading.Tasks; using System.Text; using System.Linq; using System.IO;//www .j a va2s . co m using System.Collections.Generic; using System; public class Main{ public static void CopyFile(string dir1, string dir2) { dir1 = dir1.Replace("/", "\\"); dir2 = dir2.Replace("/", "\\"); if (File.Exists(System.Web.HttpContext.Current.Request.PhysicalApplicationPath + "\\" + dir1)) { File.Copy(System.Web.HttpContext.Current.Request.PhysicalApplicationPath + "\\" + dir1, System.Web.HttpContext.Current.Request.PhysicalApplicationPath + "\\" + dir2, true); } } }