session.FileExists hangs when no file but returns 'true' when when there is as expected.
Hi,
I'm using VB .net within Visual Studio but the FileExists hangs and does nothing when no file exist on remote SFTP server. ie it doesn't receive a 'false'. PutFiles and GetFiles seem fine.
Also MoveFiles also hangs if the file moved to exists. Is there a overwrite for this? Or at least return an error code so it can be handled.
And RemoveFiles hangs if no file exists to remove.
Just used this sites exact sample as provided and this hanged when the GET file didn't exist???
Cheers
Andrew
I'm using VB .net within Visual Studio but the FileExists hangs and does nothing when no file exist on remote SFTP server. ie it doesn't receive a 'false'. PutFiles and GetFiles seem fine.
If session.FileExists(toFile) Then session.RemoveFiles(toFile) End If
Also MoveFiles also hangs if the file moved to exists. Is there a overwrite for this? Or at least return an error code so it can be handled.
And RemoveFiles hangs if no file exists to remove.
Just used this sites exact sample as provided and this hanged when the GET file didn't exist???
Public Function Main() As Integer Try ' Setup session options Dim sessionOptions As New SessionOptions With sessionOptions .Protocol = Protocol.Sftp .HostName = "xx-xxxx.xxx-xxx.xxxx" .UserName = "xxxxxx" .PortNumber = "8822" .SshHostKeyFingerprint = "ecdsa-sha2-nistp521 x xx:ex:xx:fe:xx:bc:ex:cx:xx:xx:xx:xx:cx:xc:xb:xx" .SshPrivateKeyPath = "C:\xxxx\xxxxx\Documents\private_key.ppk" End With Using session As New Session ' Connect session.Open(sessionOptions) ' Download files Dim transferOptions As New TransferOptions transferOptions.TransferMode = TransferMode.Binary Dim transferResult As TransferOperationResult transferResult = session.GetFiles("\Test\Outbox\Pricelists\xxxx-pricebooks-global.xml", "C:\Users\Documents\xxxx-pricebooks-global.xml", False, transferOptions) ' Throw on any error transferResult.Check() ' Print results For Each transfer In transferResult.Transfers Console.WriteLine("Download of {0} succeeded", transfer.FileName) Next End Using Return 0 Catch e As Exception Console.WriteLine("Error: {0}", e) Return 1 End Try End Function
Cheers
Andrew