Results 1 to 7 of 7

Thread: VB: Copy file(s) between PC on the same domain

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2007
    Posts
    12

    VB: Copy file(s) between PC on the same domain

    Hello, I'm so frustrated looking for answer on this. It sounds very easy and yet very hard to look for solution.

    I need a simple code to allow me to transfer file(s) from computer1 to computer2 which are connected on the same domain. I'm not talking about FTP.

    It's kind of like copy \\computernameA\c$\folderA\file*.xls to \\computernameB\d$\folderB\file*.xls

    Please note that everytime I connect to any computer, it prompts me for username, password, and domain name.

    How is this doable in VB6? If I'm copying a large chunk of file, would it be a problem? Also, is there a way of having a progress bar while it's copying the file(s)?

    Thank you very much.

  2. #2

    Thread Starter
    New Member
    Join Date
    Jun 2007
    Posts
    12

    Talking Re: VB: Copy file(s) between PC on the same domain

    Hello it's me again.

    I've searched the net and I found a very close solution. But still not good enough. I found the use of wininet.dll.

    What it does is it connects to the pc first with the username, password, and domain. Then once connected, I could use any methods in there such as MakeDir, GetFile, or PutFile.

    The only problem I have with this is that it only connects to the destination's FTP folder. I need to freely move around the destination's PC with the username and password I provided. Kind of like using internet explorer and typing \\computername\c$ and then supplying username and password. Once connected/authenticated, I could just drag and drop files from my pc to the remote pc.

    Please help

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2007
    Posts
    12

    Talking Re: VB: Copy file(s) between PC on the same domain

    Since the weekend is done, I'm guessing all the gurus are back

    Please help!

    Thank you very much.

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: VB: Copy file(s) between PC on the same domain

    If the PC is secured (which it sounds like),you can't do what you want. If you share the drive on the computers you want to access (share the root directory if you want access to the entire drive), you can either address them as \\server\sharename\subdirectory, or you can map them and address them as mappeddriveletter:\subdirectory
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  5. #5

    Thread Starter
    New Member
    Join Date
    Jun 2007
    Posts
    12

    Re: VB: Copy file(s) between PC on the same domain

    What do you mean by secured? I've got access to it with my username and password. I could transfer files back and forth using the convention of \\servername\drive\folder\subfolder using normal window. All I need is to do this functionality using VB.

  6. #6
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: VB: Copy file(s) between PC on the same domain

    You'll have to map the remote drives and copy the files between drive letters.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  7. #7
    Addicted Member joe1985's Avatar
    Join Date
    Jun 2007
    Posts
    151

    Re: VB: Copy file(s) between PC on the same domain

    System.IO.File.Copy accepts UNC paths.


    Example:
    Code:
      System.IO.File.Copy("\\" + server1 + "\" + share1 + "\readme.txt", "\\" + server2 + "\" + share2 + "\readme.txt")
    If its prompting you for a username and password, maybe start your application by right clicking on it and choosing "Run-As" and typing your username and password since its obviously not inheriting your security rights.

    - Joe

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width