Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copying a file 1

Status
Not open for further replies.

jmycr

Programmer
Mar 11, 2002
48
US
Is there a way to copy a file from computer to another using vb
 
Assuming you have either a mapped drive or a resolvable name and are authenticated on the network.

In the System.Io namespace there is a class called File. File has a .copy method

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
How would I specify the other machine?
 
If i remeber correctly

file.copy("mylocalfile","\\mycomputer\myfolder")

To lazy to open vb.net on a saturday :D


- - - - - - - - - - - - - - - - - -
Im three apples high, Im blue, and i most certainly like that cold beer that should be every mans right after a hard days work!
 
does it automaticall assume the c drive or do i need to specify that as well
 
does it automaticall assume the c drive or do i need to specify that as well
The three parts to a UNC file are:
[tab]Machine name - the netbios name of the other computer
[tab]Share name - the name of the shared directory on the other computer
[tab]Path - the path down from the shared directory.

Assembled, it looks like this:
\\MachineName\ShareName\Path

So if I had a directory shared named public on my machine named chipdev, and you wanted a file named goodstuff.txt in a directory named tektipsfiles, the UNC would be:

\\chipdev\public\tektipsfiles\goodstuff.txt

Note that since public is a share name, it could be mapped to any drive and any path on my machine (for example: d:\download\mypublicstuff ), but you'd see it as \\chipdev\public

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top