Get Metadata activity fails when trying to retrieve the lastModified attribute of a folder RRS feed

  • Question

  • Hi,

    I have a Get Metadata activity within a For each loop which loops through each item of a blob container.

    It is defined to return the item name and the last modified date but whenever a folder is present in the blob container, the Get Metadata activity fails with the following error:

    Field 'lastModified' failed with error: 'Type=Microsoft.WindowsAzure.Storage.StorageException,Message=The remote server returned an error: (404) Not Found

    Don't folders also have a lastModified attribute?

    I tried using dynamic content to default the value, e.g.:

     @coalesce(item().['Last modified'],'')

    but the dynamic content object doesn't appear in the output.

    Why isn't the dynamic content in the output?

    Should I handle this situation in a different way?

    Wednesday, April 15, 2020 7:04 AM

All replies

  • Hello Fabien Arnaud and thank you for your question.

    The answer is a little nuanced, so please let me explain.

    In blob storage (no hierarchical namespace), folders do not really exist the way they do in your local filesystem.  What you see as folders are a logical construct.  When you ask to list the items in a folder, what really it really asks is, "tell me all the blobs whose full name starts with 'myfolder/' ".  So since the folders do not really exist, you can't get the size of a folder or date of a folder.

    This is different in Azure Data Lake Storage Gen2 (blob storage + hierarchical namespace).  ADLS gen2 has actual folders, and you can query them.

    So the short answer is, "no, blob folders do not have lastModified attribute".  You can use a filter activity to screen out the folders from the files before passing them to the ForEach loop.  You would filter on the "itemType" from Get Metadata.

    Wednesday, April 15, 2020 11:34 PM
  • Since i have not heard back, I will assume the issue resolved.
    Tuesday, April 21, 2020 9:31 PM