ADF -GetMetadata show file exists even if file is not present

Khushboo Dubey 21 Reputation points
2022-02-03T04:24:03.577+00:00

I have a folder in which there are many files (txt files) ,I am using GetMetadata to check if any file exists or not.
so in data set I mention
170770-image.png
but even if no file exists it give exists=true

170831-image.png

How to dynamically provide filename ?as I tried giving *.txt but this also fail

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

Accepted answer
  1. AnnuKumari-MSFT 30,601 Reputation points Microsoft Employee
    2022-02-03T15:33:41.483+00:00

    Hi @Khushboo Dubey ,
    Thankyou for using Microsoft Q&A platform and posting your query.

    Since the dataset is pointing to a folder in your case, it is checking the existence of the folder (not the file within) . The reason being you have set the file name as blank. Now, to your question - How to get the list of .txt files in a specific folder .

    There is no option to use wildcard in GetMetadata activity . So , *.txt won't work. So, a better workaround is to get the list of all files from a folder using GetMetadata(childItems) and then use filter activity to get .txt file names.
    171045-image.png

    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
    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Samy Abdul 3,366 Reputation points
    2022-02-03T07:29:52.473+00:00

    Hi @Khushboo Dubey ,this was a bug around 3 years back, which has been addressed successfully. Did you double check whether you are

    inadvertently passing on the file path. As far as passing dynamically filename you should leverage parameters:

    https://www.youtube.com/watch?v=f_9LjNXWYSc

    https://www.youtube.com/watch?v=L165TgZZfHk

    https://stackoverflow.com/questions/69541637/how-can-i-pass-the-file-name-path-after-copy-data-step-to-azure-functions-in Thanks