473,386 Members | 1,610 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

C# File.Copy extremely slow over the network.

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.
Nov 22 '05 #1
2 6977
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.

"Tom" <ts******@gmail.com> wrote in message
news:c7**************************@posting.google.c om...
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.

Nov 22 '05 #2
Tom
Because I want to to copy the sub directories too.

"Jim Hughes" <NO*********@Hotmail.com> wrote in message news:<u4**************@TK2MSFTNGP15.phx.gbl>...
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.

"Tom" <ts******@gmail.com> wrote in message
news:c7**************************@posting.google.c om...
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.

Nov 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tom | last post by:
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...
2
by: Glen Conway | last post by:
Hi, I am trying to get the contents of a file in a hidden share on a remote server, something like '\\server.domain.com\c$\program files\application\document.xml'. When I try any of the...
1
by: Matthew Eno | last post by:
I have a problem where I'm developing some code that moves files from one place to another (on the same drive) with the destination file having a new name. What's happening is that the line of...
8
by: Sarah | last post by:
I need to access some data on a server. I can access it directly using UNC (i.e. \\ComputerName\ShareName\Path\FileName) or using a mapped network drive resource (S:\Path\FileName). Here is my...
3
by: Rabbit | last post by:
Dear All, I am development my web application on my PC, while its testing under the local area network environment (http://192.168.0.2/webapp/default.aspx), the speed and response are all very...
35
by: keerthyragavendran | last post by:
hi i'm downloading a single file using multiple threads... how can i specify a particular range of bytes alone from a single large file... for example say if i need only bytes ranging from...
1
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C programming. FYI Although I have called this...
3
by: Barry Flynn | last post by:
Hi I am working with a VB 2005 program which has been converted from VB6. It writes data out to a flat file, with code like the following line WriteLine(riFileNo, "Hist", lsAssetID,...
2
by: keri | last post by:
Hi, I have a db that has a linked table (excel file). The problem I am having is that the linked table is on a network drive and causing the db to be very slow, plus users are not always on the...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.