8

I need to load help files from my windows C# application and move/copy to other system (to its local drive). Application (same C# windows application) on the local system will use it for help.

What needs to be done to accomplish this?

I understand File.Copy() but i don't know, will it hold for remote system also?

lokusking
  • 7,396
  • 13
  • 38
  • 57
Dhanapal
  • 14,239
  • 35
  • 115
  • 142
  • Other than 'System.IO.File.Copy("source", "destination")' using a remote share for the second part? (or \\machinename\path\\) – jerryjvl Jun 03 '09 at 13:06
  • Is the remote machine on the same domain? Can you guarentee that the user of your app has write access privileges on the remote machine? – ChrisBD Jun 03 '09 at 13:22

2 Answers2

12
File.Copy(
    @"C:\localpath\file.hlp", 
    @"\\remotemachinename\localpathonremotemachine\file.hlp");

Or something along those lines... the second value is a UNC path.

And in case the target location needs a login and password, the following answer is applicable: Copy file to remote computer using remote admin credentials (Thanks to Carlos Rendon for finding it).

Community
  • 1
  • 1
jerryjvl
  • 19,723
  • 7
  • 40
  • 55
3

File.Copy() Copies an existing file to a new file. The target can be a remote share (UNC).

gimel
  • 83,368
  • 10
  • 76
  • 104