Reputation: 1553
I have an Azure environment with Logic Apps and a storage account. My pipeline moves data from SharePoint to the storage account with a "When a file is created or modified (properties only)" trigger.
Every time my pipeline copies a folder, it also creates a file with the same name in the storage account:
Here is my Logic Apps pipeline:
How can I prevent those files being created per each copied folder?
Upvotes: 0
Views: 795
Reputation: 8244
If you are following the same flow as mentioned, the flow will fail at Get file content using path (Folder path + file name with extension)
step itself, since SharePoint could differentiate between file and folder.
Create Block Blob
Step will be creating additional empty files as because Blob Storage will not consider folders or files as 2 different things.
It takes both file and folder as blob. So, when you are trying to create a blob inside storage account (which is probably a folder) it will create an additional empty file for folder too.
After reproducing from my end, to reproduce the same results as yours, I have enabled the Configure run after for Create Block Blob
Step.
Hierarchy in Storage Account:
Alternatively, if there is no 'Configure run after' in your flow, you can add trigger condition to your logic app trigger. Consider you have folders in SharePoint as below.
folder1/f2/f3/sample.txt
With the same flow the logic app will be triggering 4 times.
To avoid such mishaps, you need to mention the below trigger condition in your trigger.
@equals(triggerBody()?['{IsFolder}'], false)
Results:
Upvotes: 1