"option confirm off" to vb.net

Advertisement

ocproject
Joined:
Posts:
1

"option confirm off" to vb.net

Hello, before writing I tried to understand the forum but did not succeed. Forgive me. I have implemented this code in vb.net:

                          Dim session As New Session
                           Try
                               ' Upload files options
                               Dim transferOptions As New TransferOptions
                               transferOptions.TransferMode = TransferMode.Binary
                               ' Setup session options
                               Dim sessionOptions As New SessionOptions
                               With sessionOptions
                                   .Protocol = remote.Protocol
                                   .HostName = remote.HostName
                                   .UserName = remote.UserName
                                   .Password = remote.Password
                                   .PortNumber = remote.PortNumber
                                   .GiveUpSecurityAndAcceptAnySshHostKey = remote.GiveUpSecurityAndAcceptAnySshHostKey
                                   .SshHostKeyFingerprint = remote.SshHostKeyFingerprint
                                   .TimeoutInMilliseconds = 4 * 60 * 1000 ' min * sec * millisec
                                   .Timeout = TimeSpan.FromMinutes(4)
                               End With
                               ' Will continuously report console
                               AddHandler session.OutputDataReceived, AddressOf OutputDataReceived
                               ' Will continuously report progress of synchronization
                               AddHandler session.FileTransferred, AddressOf FileTransferred
                               ' Connect
                               session.Open(sessionOptions)
                               ' Synchronize files
                               Dim synchronizationResult As SynchronizationResult
                               synchronizationResult = session.SynchronizeDirectories(SynchronizationMode.Remote, local_path, remote_path, False, True, SynchronizationCriteria.Time)
                               ' Throw on any error
                               synchronizationResult.Check()
                               Log("End syncronize", "SUCCESS", Color.Green)
                           Catch _e As Exception
                               Log(_e.Message, "ALERT", Color.Red)
                           Finally
                               session.Close()
                           End Try

In every way I have tried to bypass the error when a file is not synchronized. But unfortunately I can not understand the command to be set to simulate the "option batch on" and "option confirm off". So unfortunately I get the error:

10/01/2017 18:47:32 - INFO - File or folder '***\import_list_rows_917613.txt' does not exist.
10/01/2017 18:47:32 - INFO - System Error.  Code: 2.
10/01/2017 18:47:32 - INFO - Impossibile trovare il file specificato
10/01/2017 18:47:37 - INFO - (A)bort, (R)etry, (S)kip, Ski(p) all: Abort
10/01/2017 18:49:45 - ALERT - Timeout waiting for WinSCP to respond

help me please :(

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: "option confirm off" to vb.net

Sorry, I do not understand your question.
What is that problem? The synchronization does not work at all? Or do you want to ignore occasional errors somehow? What errors?

Reply with quote

martin
Site Admin
martin avatar

How can you get "File or folder '***\import_list_rows_917613.txt' does not exist." during synchronization? Does the file disappear during the operation?

Reply with quote

Advertisement

You can post new topics in this forum