How to get the count of containers in blob storage account using Azure Data Factory?

There is a blob storage account, the name of the blob storage account is azureblob11 it has a container with the name source.

The container source contains 2 level subfolders.

enter image description here

The folder structure looks similar:

source (container)
  |--a (folder)
     |--ana (sub-folder)
     |--hem (sub-folder)
     |--thg (sub-folder)
     |--oud (sub-folder)
     

I have copied the sub-folders along with their data to the container level and created these 4 subfolders as new containers along with their data.

The folder structure looks like this after copying the sub-folders to container level

source (container)
  |--a (folder)
     |--ana (sub-folder)
     |--hem (sub-folder)
     |--thg (sub-folder)
     |--oud (sub-folder)
ana (container)
hem (container)
thg (container)
oud (container)     

The goal I am trying to achieve is to find the count of containers in the storage account that I have copied from sub-folder level to container level using Azure Data Factory.

Upvotes: 0

Views: 1821

Answers (1)

RahulKumarShaw
RahulKumarShaw

Reputation: 4602

Here is my list of Subfolder I.e., Output of Get Metadata:

enter image description here

As a workaround we can count the subfolder instead of count container.As you are making containers from subfolder only.

To get the count of subfolder you should use the length function.

Step 1 > On a pipeline Create a Variable FolderCount of String type.

enter image description here

Step 2 > Select the Set Variable Activity on GetMetaData DataSet.

enter image description here

Step 3 > Inside SetVariable Activity navigate to Variable and add dynamic content. enter image description here

enter image description here

Step 5 : Now final debug.

enter image description here

Upvotes: 1

Related Questions