How to validate the required file size in ADF where file size more than 10 mb it should failed otherwise pass.

Kumari, Shweta 41 Reputation points
2022-09-22T08:18:24.197+00:00

Hello,

I am trying to find the min and max size file size and I am using the if-else activity to validate the size of the file here if the file size is more than 10 Mb it should fail otherwise pass.

please help me with the correct solution for finding the size.

Thank you in Advance!

243729-image.png

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

2 answers

Sort by: Most helpful
  1. KranthiPakala-MSFT 46,642 Reputation points Microsoft Employee Moderator
    2022-10-04T01:41:03.923+00:00

    Hello @Kumari, Shweta ,

    Thanks for the question and using MS Q&A platform.

    As suggested by @Nandan Hegde , you will have to use a GetMetadata activity to get the file size and then pass that value to your IF condition activity and write an expression for the condition to check if the file size if <= 10MB (nothing but 10485760 binary bytes)

    247222-image.png

    Sample Condition expression: @lessOrEquals(activity('getFileSize').output.size, 10485760)

    Once you have the above condition in IF activity, in the true path you can have the actual flow and in the false path (if size >10MB) have a fail flow as per your specific need.

    Hope this clarifies. If the above information from @Nandan Hegde was helpful, please do consider to click accept answer and up-vote it as it would be helpful for others reading this thread.

    And if you have further questions, please let us know.

    Thank you

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

    • 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
    1 person found this answer helpful.
    0 comments No comments

  2. Nandan Hegde 36,146 Reputation points MVP Volunteer Moderator
    2022-09-29T17:56:45.823+00:00

    Hey,
    You can use get meta data activity to get the file size and compare it with your base value

    0 comments No comments

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.