tags:

views:

143

answers:

3

Will data traffic go through the host application program or will be dealt remotely in scenarios where C#'s File.Copy is used:

File.Copy(@"\\SERVER13\LOL\ROFL.txt", @"\\SERVER13\ROFL.txt")

Cheers n thx!

+2  A: 

It will go through the local application. The file system does not know what the application is going to do with the bytes it reads from the share, or where the bytes that are written to the share come from.

In addition, the application does not know (in the case of DFS) if the two shares are on the same machine.

Franci Penov
+1  A: 

If you want to let the server handle it, you have to remotely run a copy program.

Koen
+1  A: 

First of all you have a small bug in the path of the destination file.

Second, there are no remote copy operation. There exist a remote move operation (rename, but with a destination in other directory) like MoveFile (see native API http://msdn.microsoft.com/en-us/library/aa365239%28VS.85%29.aspx).

UPDATED: Probably you came from unix and knows utility rcp, but it works with respect of remote shell service (rshd) and not with respect of direct file system features. You can also use PsExec utility from SysInternals (see http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx) to start some program on the remote computer, but all this is not a subject of programming.

Oleg
First, what is the trgt bug? :)Second, a remote copy is exactly what I want, I'll pinvoke it :)Updated: The target machines are all MAC OS, running already an application on mono. I would like not to incorporate the logic I want there, but I assume I will. I thought that CIFS could be more intelligent in the remote machine.
Aggelos Mpimpoudis
Destination path @"\\SERVER13\ROFL.txt" has no share name LOL or another. Do you want copy file in other destination directory? Should it be @"\\SERVER13\LOL\Dir\ROFL.txt"?
Oleg