@Ananya Dixith Thanks for reaching out. You can retrieve the directory names using split function within compose action as "split(items('For_each')?['DisplayName'],'/')
" and get first string which is directory name by using another compose action with input as "outputs('Compose')[0]
". For your reference, I have tested this in my environment and here is the process. Here is my structure which is almost same as yours.
logic app is as follows:
Logic app code:
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"For_each": {
"actions": {
"Compose": {
"inputs": "@split(items('For_each')?['DisplayName'],'/')",
"type": "Compose"
},
"Compose_1": {
"inputs": "@outputs('Compose')[0]",
"runAfter": {
"Compose": [
"Succeeded"
]
},
"type": "Compose"
}
},
"foreach": "@body('Lists_blobs_(V2)')?['value']",
"runAfter": {
"Lists_blobs_(V2)": [
"Succeeded"
]
},
"type": "Foreach"
},
"Lists_blobs_(V2)": {
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/foldersV2/@{encodeURIComponent(encodeURIComponent('JTJmaGhqbGxs'))}",
"queries": {
"useFlatListing": false
}
},
"metadata": {
"JTJmaGhqbGxs": "/hhjlll"
},
"runAfter": {},
"type": "ApiConnection"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"Recurrence": {
"evaluatedRecurrence": {
"frequency": "Month",
"interval": 3
},
"recurrence": {
"frequency": "Month",
"interval": 3
},
"type": "Recurrence"
}
}
},
"parameters": {
"$connections": {
"value": {
"azureblob": {
"connectionId": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxx/resourceGroups/rgn/providers/Microsoft.Web/connections/azureblob",
"connectionName": "azureblob",
"id": "/subscriptions/
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxx
/providers/Microsoft.Web/locations/southindia/managedApis/azureblob"
}
}
}
}
}