Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File.Copy from Unc path to (same server's) Unc path inquiry

Tags:

c#

cifs

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!

like image 910
Aggelos Biboudis Avatar asked Jun 11 '10 16:06

Aggelos Biboudis


2 Answers

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.

like image 81
Oleg Avatar answered Oct 13 '22 20:10

Oleg


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.

like image 36
Franci Penov Avatar answered Oct 13 '22 20:10

Franci Penov