Copy files over LAN

Developer

Active member
Joined
May 30, 2007
Messages
29
Programming Experience
Beginner
Hey,

A quick question for the experts. I want to be able to copy images from one computer to another over a LAN using vb.net, would I be able to do this in code with the system.io.files command? If not how would I go about this?

Also is there a way I can access a folder over a LAN without it being a shared folder?


Thanks in advance.
 
You copy files over the network the exact same way you copy normally.

As long as you have access to the folder over the network you can do this.

If my file was located on machine1 in shared folder MYSHARE

use the address "\\Machine1\MYShare\yourfile.txt" to your destination.

If the folder is not shared, you can still access but you would need access to that system file system. This access is normally restricted for the administrator accounts.


"\\Machine1\C$\myfolder\yourfile.txt"

So use what ever method of copying you want but just put in the correct folder\address.
 
Thanks Vinne881,

The part where you said "you can still access even tho it is not shared", can you give me a little more detail on that.

Cheers
 
Sorry I was just having a hard time understanding the "you would need access to that system file system" part.

Does this mean that you would have to share the folder across the LAN gain access and there is no way around this?
 
If you have access to the machine that houses the file you want (For test purposes use the Domain admin account).

open windows explorer and type \\{ComputerName}\{DriveLetter}$\{Folder}\{FILE}

so if My computer was named COMPUTER1, my drive was C, my folder was WINNT and my file is TEST.TXT

"\\COMPUTER1\C$\WINNT\TEST.TXT"

This will allow direct access w/o there being a share.
 
Hey Vinne,

I still can't access the file even when in admin.

The code basically goes like this without sharing the folder:

If Files.Exists("//IPAddress/C$/TestFolder/Test.jpg") Then
'''Do what you like with the image
End If

But this isn't working. It will only work if I shared the folder using

If Files.Exists("//IPAddress/TestFolder/Test.jpg") Then
'''Do what you like with the image
End If

Any advise on where I went wrong?

cheers
 
Yes sorry it was a typo,

If Files.Exists("\\IPAddress\C$\TestFolder\Test.jpg") Then
'''Do what you like with the image
End If

Doesn't work.
 
Back
Top