Get dynamic folder names to get latest file

Kumar, Arun 341 Reputation points
2023-06-15T21:29:02.3066667+00:00

Hello,

I am getting blob inventory setup to load csv file in my blob container. The csv file is loaded every day in the folder structure as below, for example for each day of the month it loads in the folder yyyy/mm/dd/hh-mm-ss/blobstorage/blob.csv

storage > 2023/06/01/20-03-08/blobstorage/blob.csv

storage > 2023/06/02/19-54-10/blobstorage/blob.csv

storage > 2023/06/03/19-56-37/blobstorage/blob.csv

storage > 2023/06/04/20-05-09/blobstorage/blob.csv

.....

I am able to get the part yyyy/mm/dd (ex: 2023/06/01) using Get Metadata activity. But the folder hh-mm-ss (in bold above) keeps changing every day because of the run time.

So if i keep the below expression with Get Metadata as Child Items, the activity throws error at time (hh-mm-ss).

@concat(formatDateTime(utcnow(),'yyyy/MM/dd'),'/',formatDateTime(utcnow(),'hh-mm-ss'),'/','blobstorage')

Any idea how this changing time value can be captured dynamically?

Thanks,

Arun

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,958 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
3,214 questions
Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
5,392 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,687 questions
0 comments No comments
{count} votes

Accepted answer
  1. KarishmaTiwari-MSFT 20,802 Reputation points Microsoft Employee Moderator
    2023-06-19T22:51:10.2766667+00:00

    @Kumar, Arun I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this!

    Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer. Accepted answers show up at the top, resulting in improved discoverability for others.

    Issue: Cx wanted to understand how changing time value can be captured dynamically, for their scenario shared in the question.

    Solution: This worked for the Cx -

    @concat(formatDateTime(utcnow(),'yyyy/MM/dd'),'/','*','/','*','/')
    
    

    If your issue remains unresolved or have further questions, please let us know in the comments how we can assist. We are here to help you and strive to make your experience better and greatly value your feedback.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Vinodh247 35,221 Reputation points MVP Volunteer Moderator
    2023-06-16T01:03:13.6266667+00:00

    Hi,

    Thanks for reaching out to Microsoft Q&A.

    Pls go through the below link which has working solution for a requirement as similar as yours.

    https://stackoverflow.com/questions/70055595/using-adf-get-the-latest-folder-based-on-timestamp-in-folder-name

    Let me know if this worked for you.

    Please Upvote and Accept as answer if the reply was helpful, this will be benefitting the other community members who go through the same issue.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.