Save File Path to Table

Ariel M 56 Reputation points
2023-06-09T01:59:47.0666667+00:00

I need to import multiple files. Instead of saving the file name with each record, how do you save the entire file path?

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

2 answers

Sort by: Most helpful
  1. Vahid Ghafarpour 23,385 Reputation points Volunteer Moderator
    2023-06-09T03:12:30.3633333+00:00

    Create a parameter or variable, let's say filePath, to store the entire file path. You can set its value using an expression.

    If you're using a parameter, you can use the following expression in the parameter's value field:

    @concat(dataset().folderPath, '/', dataset().fileName)
    

    If you're using a variable, you can use the Set Variable activity and set the variable's value with the expression: @concat(dataset().folderPath, '/', dataset().fileName). Here, dataset().folderPath and dataset().fileName are system variables provided by Azure Data Factory that represent the folder path and file name, respectively, of the current file being processed.

    0 comments No comments

  2. QuantumCache 20,366 Reputation points Moderator
    2023-06-21T00:32:29.1433333+00:00

    Hello @Ariel M,

    I have a dynamic folder from where I read daily file from a folder which is created dynamically. I hope this helps with your scenario!

    User's image

    User's image

    User's image

    S500USCustomers/@{formatDateTime(utcnow(), 'yyyy-MM-dd')}
    
    
    

    Inside the ForEach, I have GetMetaData:

    the Source File path has an expression:

    @concat('input/S500USCustomers/',formatDateTime(utcnow(), 'yyyy-MM-dd'),'/', item().name)
    
    

    User's image


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.