C# File.Copy extremely slow over the network.

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.
 
J

Jim Hughes

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top