Topic ""option confirm off" to vb.net"

Author Message
ocproject
[View user's profile]

Joined: 2017-01-11
Posts: 1
Hello, before writing I tried to understand the forum but did not succeed. Forgive me. I have implemented this code in vb.net:

Code:
                          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:

Code:
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 Sad
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25767
Location: Prague, Czechia
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?
Guest




I wish I'd skip as the default operation
no abort Sad
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25767
Location: Prague, Czechia
How can you get "File or folder '***\import_list_rows_917613.txt' does not exist." during synchronization? Does the file disappear during the operation?
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License