Search code examples
azureazure-data-factoryazure-databricks

Can I use my ADF Filter activity to copy two or more file types?


I have a location where there are .csv, .txt and .hr files altogether. I am using a filter in my ADF pipeline to filter .txt right now and copying it using Filter Settings condition @contains(item().name, '.txt'). enter image description here Now, I want to copy .csv files as well.

I have tried Filter condition as @endswith(item().name, ['.txt','.csv']) and @contains(item().name, ['.txt','.csv']) which doesn't work.

So, What other options I can use And If I can use my existing Filter to copy both csv and txt files How do I do that ?


Solution

  • You can use the or function with the contains function to filter both .txt and .csv files in your Azure Data Factory pipeline. Below is the expression:

    @or(contains(item().name, '.txt'), contains(item().name, '.csv'))
    

    In this condition, the contains function is used to check if the file name contains either .txt or .csv. The or function is used to combine the two comparisons using the logical OR operator.

    enter image description here