0 votes
by (200 points)

We have a customer SFTP to which we can connect, list files available for downlaod, but when we wan't to download these files, there is a 'file not found error'

The files are in a subdirectory but if i look in the detailed log it seems that the component is searching for the files in the root-directory. could this be a component error?

2023-03-27 09:56:22.914 Opening log file.
2023-03-27 09:56:22.914 INFO FileLogWriter(2)[1] Info: Assembly: Rebex.Common R6.10 for .NET 4.6-4.8
2023-03-27 09:56:22.914 INFO FileLogWriter(2)[1] Info: Platform: Windows 6.2.9200 32-bit; CLR: 4.0.30319.42000
2023-03-27 09:56:22.914 DEBUG FileLogWriter(2)[1] Info: Culture: de; Windows-1252
2023-03-27 09:56:22.914 INFO Sftp(3)[1] Info: Connecting to xxx.com:22 using Sftp.
2023-03-27 09:56:22.914 INFO Sftp(3)[1] Info: Assembly: Rebex.Sftp R6.10 for .NET 4.6-4.8
2023-03-27 09:56:22.914 INFO Sftp(3)[1] Info: Platform: Windows 6.2.9200 32-bit; CLR: 4.0.30319.42000
2023-03-27 09:56:22.914 DEBUG Sftp(3)[1] Info: Culture: de; Windows-1252
2023-03-27 09:56:22.915 DEBUG Sftp(3)[1] Proxy: Resolving 'xxx.com'.
2023-03-27 09:56:22.915 DEBUG Sftp(3)[1] Proxy: Connecting to 150.105.112.41:22 (no proxy).
2023-03-27 09:56:22.953 DEBUG Sftp(3)[1] Proxy: Connection established.
2023-03-27 09:56:23.041 DEBUG Sftp(3)[1] SSH: Server is 'SSH-2.0-SSHD-CORE-0.14.0'.
2023-03-27 09:56:23.041 INFO Sftp(3)[1] SSH: Negotiation started.
2023-03-27 09:56:23.069 DEBUG Sftp(3)[1] SSH: Negotiating key.
2023-03-27 09:56:23.132 DEBUG Sftp(3)[1] SSH: Validating 'ssh-rsa' signature.
2023-03-27 09:56:23.132 DEBUG Sftp(3)[1] SSH: Received 2048-bit RSA server key (minimum allowed size is 1023 bits).
2023-03-27 09:56:23.169 INFO Sftp(3)[1] SSH: Negotiation finished.
2023-03-27 09:56:23.169 INFO Sftp(3)[1] Info: Server: SSH-2.0-SSHD-CORE-0.14.0
2023-03-27 09:56:23.169 INFO Sftp(3)[1] Info: Fingerprint (MD5): ed:d7:dd:5f:ea:58:54:81:78:7a:49:2a:93:77:d0:e8
2023-03-27 09:56:23.170 INFO Sftp(3)[1] Info: Fingerprint (SHA-256): XoTeo22FJc6Muz67xniVNdr7hkC7ggGfQKxPY0ZuHXE
2023-03-27 09:56:23.170 INFO Sftp(3)[1] Info: Cipher info: SSH 2.0, ecdh-sha2-nistp256, ssh-rsa, aes256-ctr/aes256-ctr, hmac-sha2-256/hmac-sha2-256
2023-03-27 09:56:23.350 DEBUG Sftp(3)[1] SSH: Allowed authentication methods for 'xxx': password, publickey.
2023-03-27 09:56:23.350 DEBUG Sftp(3)[1] SSH: Trying password authentication for 'xx'.
2023-03-27 09:56:23.463 DEBUG Sftp(3)[1] SSH: Authentication successful.
2023-03-27 09:56:23.463 DEBUG Sftp(3)[1] SSH: Opening channel 'session' (initial window size: 2097152, max packet size: 129024).
2023-03-27 09:56:23.535 DEBUG Sftp(3)[1] SSH: Requesting subsystem 'sftp'.
2023-03-27 09:56:23.600 INFO Sftp(3)[1] Command: SSHFXPINIT (4)
2023-03-27 09:56:23.667 INFO Sftp(3)[1] Response: SSHFXPVERSION (3, 0 extensions)
2023-03-27 09:56:23.667 INFO Sftp(3)[1] Info: Using SFTP v3.
2023-03-27 09:56:23.667 INFO Sftp(3)[1] Command: SSHFXPREALPATH (1, '.')
2023-03-27 09:56:23.721 INFO Sftp(3)[1] Response: SSHFXPNAME (1, '/')
2023-03-27 09:56:23.721 INFO Sftp(3)[1] Info: Home directory is '/'.
2023-03-27 09:56:23.724 INFO Sftp(3)[1] Batch: Calling Download(string = 'xxx230323114633456258814823596.xml', string = 'C:\Users\xxx\Desktop\temp\New folder', TraversalMode = 'Recursive', TransferMethod = 'Copy', ActionOnExistingFiles = 'OverwriteOlder').
2023-03-27 09:56:23.727 DEBUG Sftp(3)[1] Batch: Executing multi-file operation: Downloading, source = 'xxx230323114633456258814823596.xml', target = 'C:\Users\xxx\Desktop\temp\New folder', TransferMethod.Copy, MoveMode.All, LinkProcessingMode.FollowLinks, ActionOnExistingFiles.OverwriteOlder.
2023-03-27 09:56:23.728 DEBUG Sftp(3)[1] Batch: Normalizing target path ('C:\Users\xxx\Desktop\temp\New folder').
2023-03-27 09:56:23.728 DEBUG Sftp(3)[1] Batch: Checking target path ('C:\Users\xxx\Desktop\temp\New folder').
2023-03-27 09:56:23.734 DEBUG Sftp(3)[1] Batch: Normalizing source path ('xxx230323114633456258814823596.xml').
2023-03-27 09:56:23.734 DEBUG Sftp(3)[1] Batch: Checking source path ('/xxx230323114633456258814823596.xml').
2023-03-27 09:56:23.737 INFO Sftp(3)[1] Command: SSHFXPLSTAT (2, '/xxx230323114633456258814823596.xml')
2023-03-27 09:56:23.791 INFO Sftp(3)[1] Response: SSHFXPSTATUS (2, 2, '/xxx230323114633456258814823596.xml/')

Applies to: Rebex SFTP

1 Answer

0 votes
by (69.8k points)
selected by
 
Best answer

This is what I see in the log:

  1. After connection was established, the client was placed in the root directory:

    2023-03-27 09:56:23.667 INFO Sftp(3)1 Command: SSH_FXP_REALPATH (1, '.')
    2023-03-27 09:56:23.721 INFO Sftp(3)1 Response: SSH_FXP_NAME (1, '/')
    2023-03-27 09:56:23.721 INFO Sftp(3)1 Info: Home directory is '/'.

  2. You called Download('filename.xml', ..., TraversalMode.Recursive, ...)

From the given information, the client was instructed to download an item from the root directory. If the item is file, it is downloaded. If the item is directory, the whole directory is downloaded recursively including all subitems.

Please see API doc for TraversalMode.Recursive.

If you want to download a file which not placed directly in the current directory, please specify TraversalMode.MatchFilesDeep instead.

Of course, this will traverse whole server structure to find all occurrences, which is quite expensive operation. If you know the exact position of the file you want to download, please specify the full path. For example like this: client.Download("/orders/2022/xyzfile.xml", @"c:\orders\2022");

Another option to optimize the process is to navigate to a directory where you want to perform the search. For example like this:

client.ChangeDirectory("/orders");
client.Download("xyzfile.xml", @"c:\orders", TraversalMode.MatchFilesDeep);

The download will search for the "xyzfile.xml" file only under the "/orders" directory and its subdirectories (it will not search other directories in root).

...