Ramesh R C
Ramesh R C

Reputation: 672

Copy content from one system to another

I have 2 computer system which is connected to same network (Sys1,Sys2). If I copy any content from Sys1, I need to paste to Sys2.

Anyone please suggest, is this one work out? And also please guide to do the Task.

Thanks in advance Ramesh.

Upvotes: 1

Views: 194

Answers (2)

Alexei Levenkov
Alexei Levenkov

Reputation: 100527

Yes, this approach would work.

Note: consider using existing tools to synchronize content instead of re-inventing the wheel.

Random guess: maybe you are looking for event when something added to clipboard to implemet something similar to clipboard for remote desktop... Check following for info: Clipboard event C#

Upvotes: 1

Tilak
Tilak

Reputation: 30688

You can use MoveFile function to Move file to network location.

File.Copy will not work for UNC path. MoveFile (P/Invoke) will work.

CopyFile does not exist. So First use File.Copy to create a local temp file, then call MoveFile.

c# syntax

[DllImport("kernel32", CharSet = CharSet.Auto, SetLastError = true)]
public static extern int MoveFile([In(), MarshalAs(UnmanagedType.LPTStr)] string lpExistingFileName, [In(), MarshalAs(UnmanagedType.LPTStr)] string lpNewFileName);

Upvotes: 1

Related Questions