Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)


Topic review


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.

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")
    Dim transferOptions As New TransferOptions
    transferOptions.TransferMode = TransferMode.Binary
    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()
    For Each file In files
        transferResult = session.GetFiles(file.FullName, localFolder, False, transferOptions)
        session.MoveFile(file.FullName, sftpProcessFolder + file.Name)
        For Each transfer In transferResult.Transfers
            Console.WriteLine("Upload of {0} succeeded", transfer.FileName)

WinSCP version:
Runtime version: v4.0.30319
Win version: Windows server 2019