file.Copy("c:\sample", "\\remote\c$\sample")
because i must use other credentials to access that share.
I think i can use this:
System.Diagnostics.Process.Start("net", "use k: \\remote\c$ Password
/user:domain\administrator")
to map a disk k: and than make a simple copy to k:, but this method is
not cool because it shows the black prompt window while mapping network
dirve.
Someone can suggest me a good method?!
Thanks
Dim p As New Process
p.StartInfo.FileName = "cmd.exe"
p.StartInfo.UseShellExecute = False
p.StartInfo.RedirectStandardInput = True' advert here
p.StartInfo.RedirectStandardOutput = True'advert here
p.StartInfo.RedirectStandardError = True
p.StartInfo.CreateNoWindow = True
p.Start()
p.StandardInput.WriteLine("net use \\192.168.0.3
password/user:administrator")
p.StandardInput.WriteLine("exit")
p.Close()
System.Threading.Thread.CurrentThread.Sleep(4000)
Dim strPathFrom, strPathTo, strGet As String
strPathFrom = "C:\Program Files\PowerTestV3.1-SHT\data"
strPathTo = "\\192.168.0.3\Public1\Test"
strGet = "D:\Public1\Test"
'copy files
Dim strDBArray As String = ""
For Each str As String In dir.GetFiles(strPathFrom)
System.IO.File.Copy(str, strPathTo &
str.Substring(str.LastIndexOf("\")))
strDBArray &= strGet &
str.Substring(str.LastIndexOf("\")) & ","
End If
Next