|
-
Sep 21st, 2007, 11:49 PM
#1
Thread Starter
Hyperactive Member
[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
-
Sep 22nd, 2007, 08:07 AM
#2
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
-
Sep 23rd, 2007, 11:51 PM
#3
Thread Starter
Hyperactive Member
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
-
Sep 24th, 2007, 10:56 AM
#4
Re: [2005] copy data from one machine to another
Without revealing the username and password, post how you are trying to pass it.
-
Sep 25th, 2007, 01:19 AM
#5
Thread Starter
Hyperactive Member
Re: [2005] copy data from one machine to another
how can i set the username and password?
-
Sep 26th, 2007, 03:05 PM
#6
Re: [2005] copy data from one machine to another
Can you show us the code you use?
-
Sep 27th, 2007, 01:01 AM
#7
Thread Starter
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|