File Copy
Hello,
I want to do a small program (C#) that allows me to copy some files from one computer to another.(the computers are in the same local network).
How can I do this?
can you give me an example?
some classes that do that?
thanks
Lalit MPosted Nov 13, 2009, 1:36 AM
Lalit MPosted Nov 13, 2009, 1:36 AM
You could map a drive to the remote computer then use:
File.Copy(@"c:\myfile.txt",@"driveletter:\myfile.txt");
replacing driveletter with the letter you assigned when mapping the drive.
or you can use UNC paths:
File.Copy(@"c:\myfile.txt",@"\\machinename\c$\myfile.txt");
this would copy myfile.txt from your local C:\ drive to the remote machines C:\ drive, this would require admin permissions as it uses the C$ admin share on the remote machine.