Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string[] files = Directory.GetFiles(rootFolder, "*.xml");
- foreach (string file in files)
- {
- string otherFile = Path.Combine(otherFolder, Path.GetFileName(file));
- File.Copy(file, otherFile);
- }
- fsSource = New FileStream(backupPath, FileMode.OpenOrCreate, FileAccess.Read, FileShare.None, 1024, FileOptions.WriteThrough)
- fsDest = New FileStream(restorationPath, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None, 1024, FileOptions.WriteThrough)
- TransferData(fsSource, fsDest, 1048576)
- Private Sub TransferData(ByVal FromStream As IO.Stream, ByVal ToStream As IO.Stream, ByVal BufferSize As Integer)
- Dim buffer(BufferSize - 1) As Byte
- Do While IsCancelled = False 'Do While True
- Dim bytesRead As Integer = FromStream.Read(buffer, 0, buffer.Length)
- If bytesRead = 0 Then Exit Do
- ToStream.Write(buffer, 0, bytesRead)
- sizeCopied += bytesRead
- Loop
- End Sub
Add Comment
Please, Sign In to add comment