How to use multiple wildcard (filename extensions) to pick files in ADF?

KANNIBALA MISKIN KANNISAH 31 Reputation points
2022-09-13T10:06:56.21+00:00

I have requirement to move files from share path to SFTP using ADF.

Source location have multiple files with extensions like .json, .txt, .xml, .xls, .pdf

But I need to pick only .json, .xml and .xls files alone?

Is there any way to use multiple wilcard?

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,575 questions
0 comments No comments
{count} votes

Accepted answer
  1. AnnuKumari-MSFT 32,816 Reputation points Microsoft Employee
    2022-09-14T05:52:23.1+00:00

    Hi @KANNIBALA MISKIN KANNISAH ,

    Welcome to Microsoft Q&A platform and thanks for posting your question here.

    As I understand your ask, you want to know if there is any way to use multiple wildcards in copy activity to copy multiple file formats at the same time. Please correct me if I am wrong.

    There is no option to use multiple wildcards , however , you can use Filter activity to check for the availibility of multiple file formats using expressions like @or(contains(item().name,'.json'),contains(item().name,'.txt'),contains(item().name,'.xml')) as per your requirement

    In the following video, I have tried to reproduce your case by trying to filter out .json and .csv format.

    • Use Get Metadata activity to get the files and folders within the container
    • Use Filter activity to filter out the needed file formats.
    • Use ForEach activity to iterate through the files
    • Inside foreach, use copy activity and select wildcard option and provide '*' as the fileName . In the sink dataset, create a parameter for fileName and provide '@item().name' as the value for the parameter.

    240882-filteroutfileformatgif.gif

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you.
      Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
    3 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Nandan Hegde 32,026 Reputation points MVP
    2022-09-13T10:25:12.997+00:00

    Hey,
    Based on my understanding you cannot use multiple wildcard characters in copy activity.
    You might have to create 3 separate copy activities or iterate over the wild card characters in for each.

    @AnnuKumari-MSFT : Can you please confirm on this

    1 person found this answer helpful.

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.