2
votes

I'm using Azure Logic Apps to copy files from FTP to Blob Storage. I'm using the action "FTP - When a file is added or modified" and after this I copy the file content to a Blob Storage.

The problem is that the file is being copied to Blob Storage before it is completely added to the FTP, and I get partial files.

Is there any way to hold Azure Logic Apps such that it will only copy the file after it is completed?

2
The workflow is a little hazy. Can you redefine it? You have a remote ftp, a trigger that polls that remote-ftp. Are you (in your logic-app) taking that file and writing it to blob storage. But the issue is that the trigger is being fired BEFORE the file is completely saved-off on the remote ftp site? Thus is tries to pull a partial file?granadaCoder
Yes, exactly! And in my storage I see a partial file.user1862876

2 Answers

2
votes

This behavior happens when your FTP file system does not provide file locking. Similar behavior can occur when using the FTP-adapter in BizTalk.

In BizTalk, the best way to handle this is by modifying the client that is creating the file on FTP so that it uses temporary filenames.

  • Client creates file ftpFile.tmp
  • Client writes file content
  • Client renames ftpFile.tmp to ftpFile.xml or whatever extension is needed
  • BizTalk only picks up files with extension .xml

Major problem for me with the Logic Apps FTP connector is that you can't specify a file mask in the designer when using the connector as a trigger, which is strange, because i remember that option being available in the first version of logic apps.

2
votes

You need to Enable the Include File Content Option.

You can do this in 2 ways.
1. Go to LogicAppDesigner->Expand your FTP-Trigger ->Set yes to Include File Content

Like this

enter image description here

  1. Go to Logic App Code View-> find the Trigger JSON- > Add "includeFileContent": true inside the "Queries"