0

I have a situation where I need to transfer Zip file(Around 10 GB) from one server to another. Now there are two ways, one is using read stream and write stream -

while (inputZip.Length > nAmountWritten)
{
    buffer = reader.ReadBytes(10 * 1024 * 1024);
    bw.Write(buffer); //Binary Writer for destination
    nAmountWritten += buffer.Length;
}

Another is File.Copy.

Which way is better for transferring big files. Is it okay if I use File.Copy in such kind of scenario?

In on situation, I faced in Read And Write way is that sometime one chunk gets corrupted resulting in getting few files corrupted in Zip.

Arpit Gupta
  • 1,209
  • 1
  • 22
  • 39
  • please look at this StackOverflow article. The answer is there https://stackoverflow.com/questions/1246899/file-copy-vs-manual-filestream-write-for-copying-file – Yuri Jul 19 '19 at 14:49
  • Use File.Copy. No need to read and write this into a stream. You can run a batch file with Process() too. – smoore4 Jul 19 '19 at 14:52

0 Answers0