1. 程式人生 > >c#將檔案從一個位置複製到另一個位置

c#將檔案從一個位置複製到另一個位置

 //將原來的檔案也複製一份到新的資料夾中
                string strAttURLNew = System.Web.HttpContext.Current.Server.MapPath("~/TempFile/upfiles/") + txtZhuanFaRowGuid.Text + "\\";
                if (Directory.Exists(strAttURLNew) == false)//如果不存在就建立file資料夾
                {
                    Directory.CreateDirectory(strAttURLNew);
} string strAttURL = System.Web.HttpContext.Current.Server.MapPath("~/TempFile/upfiles/") + SendMailRowGuid.Text + "\\" + Convert.ToString(dvApps[r]["AppurtenanceName"]); if (File.Exists(strAttURL) == true)//如果不存在就建立file資料夾 { string destPath = Path.Combine
(@strAttURLNew, Path.GetFileName(@strAttURL)); System.IO.File.Copy(@strAttURL, destPath); }