Question

What I am trying to do is copying a file from a remote PC folder which is not shared. I wrote a code to connect to the PC using ManagementScope i executed some WMI queries in order to ensure that i am connected. Now the problem is when i execute the File.Copy() function as

File.Copy(@"\\Source_server\\C:\Users\ku\Desktop\test1.txt", @"\\Destination_server\\C:\Users\mo\Downloads\"); 

it shows me

Path format not supported

Does File.Copy doesn't support file copy on network?? Is there any other method to do that??

(I have the user name and password of the remote PC) -Thanks for the reply in advance

Was it helpful?

Solution

You should probably use this path:

\\Source_server\C$\Users\ku\Desktop\test1.txt

But that would require administrator rights on your server.

A better solution would be to create a shared folder on the server and use that for reading and writting files.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top