You can get close to Robocopy speed with a simple C # program that does asynchronous reads and writes using the standard FileStream with a 64 KB buffer. Large buffer sizes up to 256 KB will give a slight increase in performance. The larger 256K, the slower they will slow down. In my tests, using a 512K buffer took almost twice as much time as copying with a 256K buffer.
The idea is pretty simple:
Read the first buffer from the source file do { start asynchronous write to destination file. Read the next buffer from the source file wait for asynchronous write to complete } while not end of file
This is a pretty simple thing to write. My program, which does this almost as fast as Robocopy, and does not cause the types of problems that Robocopy causes when you copy a very large (one hundred gigabytes) from the server.
A bit more information about the problem with a large copy of the files.
Please note that this asynchronous read / write function does not greatly affect performance if you read and write to the same physical disk. This is most effective when the source and destination are on different drives.
source share