WinSCP .NET VB: Can't get attributes of file
When downloading multiple files and exception is thrown with the following error messages:
WinSCP version:1.15.0.14890
Runtime version: v4.0.30319
Win version: Windows server 2019
vb code:Script: Can't get attributes of file '/toPayerFusion/C337290N.H837PRD.C0270481.20240416.00001'.
No such file or directory.
Dim sessionOptions As New SessionOptions Dim localFolder As String = ConfigurationManager.AppSettings("ParseDirectory") Dim sftpFolder As String = ConfigurationManager.AppSettings("SFTPFolder") Dim sftpFolderPaperClaims As String = ConfigurationManager.AppSettings("SFTPFolderPaperClaims") Dim sftpProcessFolder As String = sftpFolder + ConfigurationManager.AppSettings("SFTPProcessFolder") Dim sftpProcessFolderPaperClaim As String = sftpFolderPaperClaims + ConfigurationManager.AppSettings("SFTPProcessFolder") With sessionOptions .Protocol = Protocol.Sftp .HostName = ConfigurationManager.AppSettings("SFTPHost") .UserName = ConfigurationManager.AppSettings("SFTPUser") .Password = ConfigurationManager.AppSettings("SFTPPassword") .FtpSecure = FtpSecure.None '.TlsHostCertificateFingerprint = "18:7f:a3:ad:8e:e9:9e:3b:ab:03:a6:71:1a:b6:28:e5:f3:67:e8:85" .SshHostKeyFingerprint = "ssh-rsa-hGn3OiqHcSEVML4xIvmRDpGzhTEiHBpoQBhbs1U9rzo" End With sessionOptions.AddRawSettings("ProxyPort", "0") Using session As New Session ' Connect Console.WriteLine("Open Connection....") session.SessionLogPath = ConfigurationManager.AppSettings("SessionLogPath") session.Open(sessionOptions) Dim transferOptions As New TransferOptions transferOptions.TransferMode = TransferMode.Binary '/toPayerFusion/PaperClaims Dim transferResult As TransferOperationResult Console.Write("Get Files ") Dim files As List(Of RemoteFileInfo) = session.ListDirectory(sftpFolder).Files.Where(Function(x) x.IsDirectory = False).ToList() Console.WriteLine(files.Capacity) For Each file In files transferResult = session.GetFiles(file.FullName, localFolder, False, transferOptions) transferResult.Check() session.MoveFile(file.FullName, sftpProcessFolder + file.Name) For Each transfer In transferResult.Transfers Console.WriteLine("Upload of {0} succeeded", transfer.FileName) Next Next
Runtime version: v4.0.30319
Win version: Windows server 2019