Search code examples
javamulesftpanypoint-studio

Download ZIP file from SFTP and save it to local directory


I have a mule SFTP connector from which I want to download a ZIP file and store it locally on my computer. I am using only SFTP connector and file outbound.

The issue is that the file is somehow changed to a strange file with .dat extension. I assume this is because of InputSftpStream.

Any ideas how to download a ZIP file and save the same file without any change to computer?


Solution

  • This issue occurs when file name output pattern is not defined. Please update file outbound endpoint like outputPattern="#[message.inboundProperties.originalFilename]" , this will create the file with the same name as the SFTP file name or you can change it to any desired pattern like outputPattern="xyz.zip". Something like

    <file:outbound-endpoint path="tmp" outputPattern="#[message.inboundProperties.originalFilename]" connector-ref="File" responseTimeout="10000" doc:name="File"/>
    

    Hope this help.