BizTalk 2016 SFTP Adapter not deleting files RRS feed

  • Question

  • Hello,

    I have a situation. One of my receive port with SFTP adapter downloads file but doesn't delete.

    I have 2 servers, win 2012 R2S, BTS 2016.

    One without CU5 and other with CU6. Tried on both server, still failing.

    Because files are not deleting, they get polled within my configured polling interval and send ports suspends due to file exists.

    Many other ports are working fine with other sftp server. My vendor confirmed their sftp account has Read and Delete permissions.Permission

    Anyone else experienced this SFTP behavior? Is this by design or something to do with sftp access?

    Any guidance / solution to this issue is appreciated.



    Monday, 20 January 2020 4:48 AM

All replies

  • Most likely to do with access.  BizTalk consumes files, as otherwise it doesn't know if it's already picked up that file before.

    Try using WinSCP or similar to connect to the SFTP site and delete a file manually to verify the permissions work as expected.

    If this is helpful or answers your question - please mark accordingly.
    Because I get points for it which gives my life purpose (also, it helps other people find answers quickly)
    Read my articles on: BizTalk | .NET

    Monday, 20 January 2020 1:24 PM
  • Check if the rights to delete file are there in SFTP

    If its happening for only 1 of your SFTP ports then its probably rights issue.


    Blog: My Blog

    BizTalkApplicationDeploymentTool: BizTalk Application Deployment Tool/

    Monday, 20 January 2020 1:54 PM
  • Thanks Alastair. I did tried using WinSCP & FileZilla client tools, and able to delete files manually.

    Even the "Retain After Download" is set to false on box with CU6.


    Monday, 20 January 2020 7:30 PM
  • Hey Pi_xel_xar,

    My vendor confirmed that account has Delete access and I also verified using WinSCP & FileZilla client tools, able to delete files manually.


    Monday, 20 January 2020 7:33 PM
  • Are there any warning or errors in the Application Widows Logs in Event Viewer?

    Have you enabled logging for the SFTP receive location to see if that gives any more details?

    Tuesday, 21 January 2020 7:58 PM
  • Yes Colin, I enabled logging for SFTP receive location but there is no failure or error.

    In logs, I noticed other SFTP receive location log has Deleting file command followed by Type: SSH_FXP_REMOVE. Not this one particularly.

    EventViewer has nothing other than send port suspension (warning followed by error) for file exists.


    Tuesday, 21 January 2020 9:54 PM
  • And you have double checked that you have not enabled the read-only download option? e.g. the Delete After Download set to no?  As that is only available with CU 6, I would think you won't even see that option on your CU 5 server.     But you could try that setting in CU 6 to see if it solves your immediate problem, it won't delete it, but it should not redownload it.

    When you download files from the read-only SFTP Server, the SFTP adapter is not able to work with the files that have been already downloaded as in each polling interval files are downloaded again. This improvement adds the following options to the SFTP adapter, Delete After Download which specify whether the adapter deletes a file from the FTP server after you download it, Enable Timestamp comparison which specify whether the adapter downloads a file again based on its modified timestamp and Redownload Interval which specify the interval after which the adapter downloads files again if both Delete After Download and Enable Timestamp Comparison are set to "No".

    Tuesday, 21 January 2020 10:00 PM
  • Yes, CU6 SFTP adapter has this option, Retain After Download. By default it was false, means delete the file after download.

    I tried setting it true and enabling the Timestamp comparison, but no luck. Rcv Port doesn't download the files again.

    I even tried setting it to true with Timestamp comparison disabled. Rcv Port polls within the set polling interval.


    • Edited by harryss Tuesday, 21 January 2020 10:14 PM
    Tuesday, 21 January 2020 10:13 PM
  • Was the timestamp updated on the file while you had Timestamp comparison on?  That's what will trigger it to download it again.
    Wednesday, 22 January 2020 12:23 AM
  • Yes, that's not an issue.

    My problem is files not being deleted after download, even when Retain After Download is false.


    Wednesday, 22 January 2020 6:40 PM
  • Can you check and see if the receive location is running under a clustered or non-clustered BizTalk host? Microsoft article suggests that FTP or SFTP adapter receive handlers should not, however, be configured to run in multiple BizTalk host instances simultaneously. This recommendation is made because the FTP or SFTP receive adapter uses the FTP or SFTP protocol to retrieve files from the target system. https://docs.microsoft.com/en-us/biztalk/core/considerations-for-running-adapter-handlers-within-a-clustered-host1

    You can do a test using a non-clustered host to see if it solves the issue.

    Also is there any event viewer details that can explain the cause as credentials and access or lock issues? It might be useful to ask/grab logs from the FTP site from vendor to know exaclty the cause?

    Monday, 27 January 2020 5:46 PM
  • Thanks Miguel, for pointing this out.

    Both my servers have non-clustered host. I'm still waiting on ftp log from vendor. I'll review them and come back to the forum.

    However, this is the only vendor I am having issues with. Other several ftp or sftp connections are perfectly running.


    Monday, 27 January 2020 6:50 PM
  • BizTalk 2016 CU 7 came out this month, with 3 fixes and one improvement for the SFTP adapter, none that seem directly related to your issue, but it does have "WinSCP is upgraded to 5.15.9 or later versions."   for Improvement: Revised WinSCP version support in Microsoft BizTalk Server SFTP Adapter
    Wednesday, 29 January 2020 9:03 AM
  • Thanks Colin, for the update. I'll try CU7 on my local first and update you.


    Monday, 10 February 2020 4:42 PM
  • Hi!

    In two customer environments CU7 & 5.15.9 did not help, the files are still not deleted on FTP-server even if all right are correct & the settings for the adapter are as it should be.

    Yes: All servers are restarted, manual test works and the servers aren't clustered.

    Tuesday, 11 February 2020 10:33 AM
  • Can you check to see if the SFTP Server is either an IPSWitch WS_FTPServer or a IPSWitch MoveIT SFTP server?

    I found some information from a previous customer with the following information:

    = = =

    Some customers complain that files are received, but not deleted once they are received so they will continue to delete duplicates of the file on every polling interval. After analyzing the SFTP log I have found that some SFTP servers do not have the full time stamp details in the ls(dir) listing, but it is available later in both the get and the stat command. Later when BizTalk tries to delete the file it tries to delete (rm) the file based on the initial ls(dir) time stamp which does not match.

    = = =

    No changes have been made to address this in BizTalk Server since it was determined that it is an issue with the SFTP server instead.  If you want Microsoft to reconsider creating a change for what is looked at to determine the file to delete, then please open a bug with Microsoft Support.

    Wednesday, 12 February 2020 10:19 PM
  • Additional information:

    In my customers cases there is only one in a batch that are deleted resulting in duplicate downloads of thoose file not deleted.

    • Edited by MAllstadius Thursday, 13 February 2020 2:52 PM
    Thursday, 13 February 2020 9:31 AM
  • Guys,

    Finally I gave up with this and wrote a custom code using WinSCP .net library and scheduled it to download and delete remote files. Its a quick work around, working as expected for me.

    But, I would still like to see this issue fixed.

    Thanks everyone for your valuable time and guidance.


    Thursday, 13 February 2020 6:22 PM
  • Hi Valerie.

    Are you saying IPSWitch WS_FTPServer or IPSWitch SFTP server could probably be an issue?

    I will check with my vendor and get back.


    Thursday, 13 February 2020 6:25 PM