I want to make a WinForms Application that can copy files over a LAN. Using File.Copy seems a straightforward way to do this. The example given here shows how to copy a file to a different directory on the same computer. How can I use File.Copy to copy files from one computer to another which belongs to the same LAN?
you can try
File.Copy(@"\\server\sourceFileFolder\file1", @"\\server2\destinationFileFolder\file1");
also make sure to use UNC path.. here are some references. - Link - Link - Link
Something like this
File.Copy(
"C:\path\yourfile.txt",
"\\remote_hostname\path\destinationfile.txt");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With