Copying files to remote directory

evanburen

New member
Joined
Mar 9, 2011
Messages
1
Programming Experience
3-5
Hi
I want to copy these files to another remote directory but receiving the error
"The target file "\\Z02RSIDMC02\Section\Bonds\G-269 PROCESS\FOCUSED BOND REVIEW\Uploaded Documents\test" is a directory, not a file.
I'm that familiar with using .CopyTo and haven't got very far with it. Thanks

Sub btnCopyFiles_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim info As DirectoryInfo = New DirectoryInfo("C:\Inetpub\wwwroot\G269_Focus\Uploads")
Dim files As FileInfo() files = info.GetFiles("*.pdf")
Dim file As FileInfo
Response.Write("The files below will be copied to the Bonds G269 focus review folder for processing:")
For Each file In files
file.CopyTo("\\Z02RSIDMC02\Section\Bonds\G-269 PROCESS\FOCUSED BOND REVIEW\Uploaded Documents\test", True)
Next
End Sub
 
Last edited:
Just as a guess, have you tried the following?
VB.NET:
For Each file In files 
file.CopyTo("\\Z02RSIDMC02\Section\Bonds\G-269 PROCESS\FOCUSED BOND REVIEW\Uploaded Documents\test\" & file.Name, True) 
Next
...or without the test directory...

VB.NET:
For Each file In files 
 file.CopyTo("\\Z02RSIDMC02\Section\Bonds\G-269 PROCESS\FOCUSED BOND REVIEW\Uploaded Documents\" & file.Name, True) 
 Next
 
Back
Top