protected void bt1_Click(object sender, EventArgs e) { string sourcePath = @"C:\Jesus"; string targetPath = @"D:\Jesus"; if (System.IO.Directory.Exists(sourcePath)) { string[] files = System.IO.Directory.GetFiles(sourcePath); foreach (string s in files) { string fileName = System.IO.Path.GetFileName(s); string destFile = System.IO.Path.Combine(targetPath, fileName); System.IO.Directory.CreateDirectory(@"D:\Jesus"); System.IO.File.Copy(s, destFile, true); } Response.Write("Sucessfully Created"); } }
Mark as Answer if its helpful to you Kumaraspcode2009@gmail.com
string sourcePath=@"D\MainFolder"; string destinationPath = @"E\BackupFolder"; if(Directory.Exists(sourcePath) && Directory.Exists(destinationPath)) File.Copy(sourcePath, destinationPath);
Thanks & Regards Ramakrishna.k
Login to post response