Reputation: 85126
Say I have a console application that runs on Machine1. What is happening in the background if that application copies a file from a network share on Machine2 to a network share on Machine3?
Is it going directly from Machine2 to Machine3 or would it have to pass through Machine1 since that is where the application is being run from?
The reason I ask is because, I recently wrote an application that does this and it takes about a hour to finish (huge file). When I spoke to the person who's task I was automating they said that it would finish in about 15 minutes when they were logged into Machine2 and copied to Machine3.
I am using the File.Copy method.
Upvotes: 1
Views: 647
Reputation: 69310
I haven't tried it myself, but one way might be to use Powershell to invoke a small script on Machine1 that copies the file directly to Machine2.
There is a msdn blog about how to invoke a PS script from C#. If you combine it with this WindowsITPro article on how to invoke commands remotely it might work.
Upvotes: 0
Reputation: 86848
If you are on Machine1, any standard file copy operation will have to get data from Machine2 and send it over to Machine3 (going over the network twice). FTP is the only protocol I know of that has provisions for copying files between two servers from a third server without the third server having to send and receive the data.
Upvotes: 1
Reputation: 67574
The file is downloaded to your computer then uploaded again to the destination computer, yes.
Upvotes: 1