+1 vote
by (390 points)
edited

I am testing and debugging a new inhouse utility and encountered this error "SftpException: No Such File" when trying to download a specific folder and all of it's contents including subfolders and contents. Here are the last few lines from the ftp logfile. Is there anyway to allow the connection to continue to process on an error?

2014-01-08 13:32:45.005 DEBUG Sftp(3)[8] Batch: Processing file to transfer ('/ftpOut/Downloaded/NuView_Results_201312150015.txt').
2014-01-08 13:32:45.005 DEBUG Sftp(3)[8] Batch: Checking existence of target item ('C:\temp\livevox\Downloaded\NuView_Results_201312150015.txt').
2014-01-08 13:32:45.005 DEBUG Sftp(3)[8] Batch: Transferring file ('/ftpOut/Downloaded/NuView_Results_201312150015.txt' ---> 'C:\temp\livevox\Downloaded\NuView_Results_201312150015.txt').
2014-01-08 13:32:45.006 INFO Sftp(3)[8] Command: SSH_FXP_OPEN (2352, '/ftpOut/Downloaded/NuView_Results_201312150015.txt', 1)
2014-01-08 13:32:45.088 INFO Sftp(3)[8] Response: SSH_FXP_HANDLE (2352, 0x416A68664562)
2014-01-08 13:32:45.088 DEBUG Sftp(3)[8] Command: SSH_FXP_READ (2353, 0x416A68664562, 0, 28672)
2014-01-08 13:32:45.088 DEBUG Sftp(3)[8] Command: SSH_FXP_READ (2354, 0x416A68664562, 28672, 28672)
2014-01-08 13:32:45.088 DEBUG Sftp(3)[8] Command: SSH_FXP_READ (2355, 0x416A68664562, 57344, 28672)
2014-01-08 13:32:45.088 DEBUG Sftp(3)[8] Command: SSH_FXP_READ (2356, 0x416A68664562, 86016, 28672)
2014-01-08 13:32:45.194 DEBUG Sftp(3)[8] Response: SSH_FXP_DATA (2353, 68 bytes)
2014-01-08 13:32:45.194 INFO Sftp(3)[8] Response: SSH_FXP_STATUS (2354, 1, 'End of file')
2014-01-08 13:32:45.195 INFO Sftp(3)[8] Response: SSH_FXP_STATUS (2355, 1, 'End of file')
2014-01-08 13:32:45.195 INFO Sftp(3)[8] Response: SSH_FXP_STATUS (2356, 1, 'End of file')
2014-01-08 13:32:45.195 DEBUG Sftp(3)[8] Command: SSH_FXP_READ (2357, 0x416A68664562, 68, 28672)
2014-01-08 13:32:45.275 INFO Sftp(3)[8] Response: SSH_FXP_STATUS (2357, 1, 'End of file')
2014-01-08 13:32:45.275 INFO Sftp(3)[8] Command: SSH_FXP_CLOSE (2358, 0x416A68664562)
2014-01-08 13:32:45.356 INFO Sftp(3)[8] Response: SSH_FXP_STATUS (2358, 0, 'OK')
2014-01-08 13:32:45.356 DEBUG Sftp(3)[8] Batch: Processing file to transfer ('/ftpOut/NuView_Results_201401081615.txt').
2014-01-08 13:32:45.356 DEBUG Sftp(3)[8] Batch: Checking existence of target item ('C:\temp\livevox\NuView_Results_201401081615.txt').
2014-01-08 13:32:45.356 DEBUG Sftp(3)[8] Batch: Transferring file ('/ftpOut/NuView_Results_201401081615.txt' ---> 'C:\temp\livevox\NuView_Results_201401081615.txt').
2014-01-08 13:32:45.369 INFO Sftp(3)[8] Command: SSH_FXP_OPEN (2359, '/ftpOut/NuView_Results_201401081615.txt', 1)
2014-01-08 13:32:45.481 INFO Sftp(3)[8] Response: SSH_FXP_STATUS (2359, 2, 'No such file')
2014-01-08 13:32:45.533 ERROR Sftp(3)[8] Info: Rebex.Net.SftpException: No such file; No such file.
   at Rebex.Net.ZEB.EC(TDB A, Type B)
   at Rebex.Net.ZEB.HB(String A, WFB B, Boolean C, CEB D)
   at Rebex.Net.Sftp.CAB(CEB A, String B, Stream C, Int64 D, Int64 E, XCB H)
Applies to: Rebex SFTP

1 Answer

+1 vote
by (58.9k points)
edited
 
Best answer

The batch operation (in your case Download) works like this: first it creates a FileSet of files and directories to download. In the second step the component downloads/uploads the files and directories one by one.

If I understand it correctly from the log, the "No such file" SftpException means that a remote file which was detected in step 1 is actually no more present in the remote folder when the Sftp component actually tries to download the file in step 2 of the multi-file Download operation. This is a perfectly possible situation.

To get rid of the error, please turn on the RecheckItemExistence option. This way the component will check for the item existence one more time just when it is about to do the particular download operation. As a result it will skip files which are no more present when it comes to actually downloading them.

Sftp sftp = new Sftp();
sftp.Settings.RecheckItemExistence = true;

Please let me know if this helped.

by (390 points)
edited

Thanks Tomas. I don't have that option in the Settings of the Sftp or the Ftp object

by (58.9k points)
edited

Hello Tim, the option was first added to the Rebex SFTP and Rebex FTP/SSL components in the 2013R3 release. Please download the latest free 30-day trial to give it a try. BTW versions before 2012R1 performed the check by default, which was disabled when optimizing the multi-file operations in 2012R1 release. Which version are you actually using? If you have an active support contract, you can download the full version of 2013R3, or if your support contract has expired there is a huge 67% discount.

by (390 points)
edited

Downloading it now. Thanks Tomas. We purchased in Sept 2013 so I believe that was the R2 version

by (58.9k points)
edited

You are welcome, just for your information: every purchase of Rebex components comes with a 1-year Support Contract which entitles you to download all updates released within the validity of your Support Contract as well as email support. After the first year is over we recommend to renew your support contract with a 67% discount.

...