public void FileCopy(string source, string target) { using (FileStream fileRead = new FileStream(source, FileMode.Open, FileAccess.Read,FileShare.ReadWrite)) { byte[] bb = new byte[1024 * 1024 * 5]; int r = fileRead.Read(bb, 0, bb.Length); using (FileStream fileWrite = new FileStream(target, FileMode.Create, FileAccess.Write)) { while (r > 0) { fileWrite.Write(bb, 0, r); r = fileRead.Read(bb, 0, bb.Length); } fileWrite.Close(); } fileRead.Close(); } }
此方式通用
|
请发表评论