WinSCP .NET VB: Can't get attributes of file

Advertisement

precuset
Guest

WinSCP .NET VB: Can't get attributes of file

When downloading multiple files and exception is thrown with the following error messages:
Script: Can't get attributes of file '/toPayerFusion/C337290N.H837PRD.C0270481.20240416.00001'.
No such file or directory.
vb code:
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
WinSCP version:1.15.0.14890
Runtime version: v4.0.30319
Win version: Windows server 2019

Reply with quote

Advertisement

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

Re: WinSCP .NET VB: Can't get attributes of file

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

Advertisement

You can post new topics in this forum