I want to concatenate a file name with a timestamp

Tony Johansson 40 Reputation points
2023-04-14T08:29:59.5033333+00:00

Hello! I use azure Data Factory activity get metadata to get all files and the ForEachFile. In the ForEachFile activity I have a copy activity that copy each file to a new container. This works but I must concatenate a timestamp to each file. In Pipeline expression builder have have @dataset().Filename. This Filename is defined as a parameter on the dataset level. So in the dataset level for the copy activity I have these
dataset properties
Filename @item().name
Now @pipeline().TriggerTime I have tried this @concat(dataset().Filename,dataset().Now) in the Pipeline expression builder This doesn't work because I get ,Message=The required Blob is missing Many thanks in advance

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
{count} votes

1 answer

Sort by: Most helpful
  1. KranthiPakala-MSFT 46,737 Reputation points Microsoft Employee Moderator
    2023-04-26T22:41:36.52+00:00

    Hi @Tony Johansson ,

    I'm assuming that you may have configured the dataset in your source which is resulting in this error. Please ensure that your copy activity source dataset is pointing to the correct filename. In case if you are point it the file name from your getmetadata childItems names then you will have to have an expression like Please have your sink dataset configured with dynamic expression for the file name as shown below:

    Assuming you getMetadata output likes below:
    User's image

    Source data set configuration should look like below:
    User's image

    And the sink configuration should look like below:

    @concat(split(item().name, '.')[0],'_',pipeline().TriggerTime,split(item().name, '.')[1])
    

    User's image

    Hope this helps. In case if you have further questions, please provide additional information and we can assist accordingly.


    Please don’t forget to Accept Answer and Yes for "was this answer helpful" wherever the information provided helps you, this can be beneficial to other community members.

    0 comments No comments

Your answer

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