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,206
  • 13
  • 41
  • 54
Dhanapal
  • 13,839
  • 35
  • 107
  • 141
  • 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
  • 18,917
  • 7
  • 39
  • 55
3

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

gimel
  • 78,638
  • 10
  • 72
  • 104