views:

793

answers:

4

If my .NET client uses System.IO.File.Copy to copy a file from \server1\share1\file1.txt to \sever1\share2\file2.txt, does the file's data get read down to the client and then written back up to the server? If yes, is there any way a .NET client can copy a file on a server to another location on the same server without round-tripping the file? Does it make a difference if the destination share is the same as the source share?

+1  A: 

That is an excellent question - I can't seem to find any definitive answer so perhaps the best thing would be to fire up Wireshark for a test.

Andrew Hare
Why not vote up his question then? Maybe you have and it was voted down again, but it seems many people forget to vote for good questions.
Ash
Thanks! I did forget to upvote the question :)
Andrew Hare
Thanks for the +1 and thanks for the tip on the tool. I will be updating my question with the tool's output as proof of the accepted "yes" answer, as soon as I get around to it.
flipdoubt
+3  A: 

Yes it does. I can say this from personal experience with copying 10 GB Zip files between machines. The "client" machine was on a different coast of America than the two other machines. Between the two machines directly from one of them took a reasonable amount of time. Trying to initiate the copy from the machine on the other coast took ~10 hours :(

JaredPar
+2  A: 

The file contents must go through the machine performing the Copy operation. The only way around this is to run programs on the target machine(s) that perform the transfer without the client machine in the middle. such as FXP which uses FTP to transfer server to server.
However, opening up this pathway may also open a security loophole and I suspect many admins would be reluctant to allow this.

jdigital
A: 

If it's possible to do a move instead of a copy, that should happen instantly. Otherwise you need to put a service on the target machine so you can call it remotely.

Daniel Earwicker
Really? Can you prove it?
flipdoubt
I'm not sure what you mean by "prove" here. I just demonstrated it to myself in Windows Vista. Give it a try. Use Explorer on machine A to access a share on machine B, and 'Cut' a big subfolder and 'Paste' it somewhere else under the same share. It will move instantly.
Daniel Earwicker