C# File.Copy extremely slow over the network.

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

I wrote a recursive function that calls File.copy to copy file from
one directory to another. However the performance is attrocious. It
takes close to 3 hours to copy some that can be done in like 15
minutes. There is virtually no CPU usage and very minimal network
traffic during the copy operation. On both the client and server. What
can be going on here? Is there a better way?

Any help appreciated.
 
Why make it recursive for a single directory?

Directory.CreateDirectory("test")
For Each f As String In Directory.GetFiles("..\")

File.Copy(f, "test\" & Path.GetFileName(f))

Next


Now if you wanted it recursive for subdirectories, that's a different story.
 
Back
Top