Results 1 to 7 of 7

Thread: [2005] copy data from one machine to another

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Location
    Kolkata, India
    Posts
    290

    [2005] copy data from one machine to another

    Hi

    Want to copy a file from one system to another system in network
    i.e "D:\test\Data.txt" of Machine One To "\\Rajat\test\" Machine Two
    Machine two have the user name and passowrd i.e : User Name : Rajat
    PassWord: abc123

    Pls guide how to achive the same.

    I am trying to use the shell command but unable to achive the result.


    thanks

    asm

  2. #2
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: [2005] copy data from one machine to another

    In machine 2, you give read and write permission to the "test" folder to the user account that will be running the copying code in machine 1. Having done that, back to machine 1, you just do:
    Code:
    Try
        IO.File.Copy("D:\test\Data.txt", ""\\Rajat\test\Data.txt")
    Catch ex As Exception
        MessageBox.Show(ex.Message)
    End Try

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Location
    Kolkata, India
    Posts
    290

    Re: [2005] copy data from one machine to another

    If the user machine is without user name and password it is working
    but if user machine contains the user name and password it flash a error
    i.e. "Logon failure: unknown user name or bad password" --
    How can I pass the user name and password ?

    thanks

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [2005] copy data from one machine to another

    Without revealing the username and password, post how you are trying to pass it.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Location
    Kolkata, India
    Posts
    290

    Re: [2005] copy data from one machine to another

    how can i set the username and password?

  6. #6
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: [2005] copy data from one machine to another

    Can you show us the code you use?

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Location
    Kolkata, India
    Posts
    290

    Re: [2005] copy data from one machine to another

    Code:
    Imports System.IO
    Public Class frmCopyFile
        Dim FromFile As String = ""
        Dim ToFile As String = ""
    
        Private Sub frmCopyFile_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            txtFile.Text = "Data.txt"
            txtFromMachine.Text = "D:\Test\"
            FromFile = Trim(txtFromMachine.Text) + Trim(txtFile.Text)
            txtToMachine.Text = "\\isoftnode\test\"
            ToFile = Trim(txtToMachine.Text) + Trim(txtFile.Text)
            txtUserName.Text = "Rajat"
            txtPassword.Text = "abc123"
        End Sub
    
        Private Sub cmdCopy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCopy.Click
            Try
                My.Computer.FileSystem.CopyFile(FromFile, ToFile, True)
            Catch ex As Exception
                MsgBox(ex.Message)
                Exit Sub
            End Try
            MsgBox("File Copy Successfully")
        End Sub
    End Class

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