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?
How to use File.Copy C# method to copy files over LAN?
Something like this
File.Copy(
"C:\path\yourfile.txt",
"\\remote_hostname\path\destinationfile.txt");
Try this
File.Copy(@"\\server\folder$\test.txt", "test.txt");
' code in Vb , convert it into C#
Dim findDirectory = "D:\UOLQserver\Data\Sound\"
Dim Y_N = System.IO.Directory.Exists(findDirectory)
If Y_N = True Then
Else
Directory.CreateDirectory(findDirectory)
End If
Dim MyFilename1 = findDirectory & "\" & Today.Day & "-" & Today.Month & "-" & Today.Year & "-" & tineNow & "-" & Today.Minute & ".wav"
FileCopy("\\SERVER\D$\UOLQserver\Data\Sound\test.wav", MyFilename1)
© 2022 - 2024 — McMap. All rights reserved.