I think it's solved by this https://winscp.net/eng/docs/library_session_synchronizedirectories
- Toormser
Public Function UploadBackupToOnlineStorage() As Boolean
Try
' Setup session options
Dim objSessionOptions As New SessionOptions
With objSessionOptions
.Protocol = Protocol.Sftp
.HostName = "example.com"
.UserName = "user"
.Password = "mypassword"
End With
Using objSession As New Session
' Connect
objSession.Open(objSessionOptions)
' Upload files
Dim objTransferOptions As New TransferOptions
objTransferOptions.TransferMode = TransferMode.Binary
objTransferOptions.FileMask = "*>=1D"
Dim objTransferResult As TransferOperationResult
objTransferResult =
objSession.PutFiles("D:\*", "/", False, objTransferOptions)
' Throw on any error
objTransferResult.Check()
' Print results
For Each transfer In objTransferResult.Transfers
Console.WriteLine("Upload of {0} succeeded", transfer.FileName)
Next
End Using
Return 0
Catch ex As Exception
mobjFileWriter.FileWrite(ex.ToString)
Return 1
End Try
End Function