Is it possible to delete Files in blob based on a size

sam nick 286 Reputation points
2022-01-05T05:07:39.86+00:00

I have around 10k files stored in a container. End goal is to merge them into a single file. But there are a lot of file with no data and just headers resulting in size being 50bytes. Is it possible in ADF (using delete activity) to delete all files that are less than 50bytes in size.

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

1 answer

Sort by: Most helpful
  1. Nandan Hegde 29,896 Reputation points MVP
    2022-01-05T06:18:59.323+00:00

    Hey,
    You can try the below logic:

    1. Use Get Meta Data activity to get the list of all files
    2. Then use foreach activity and within for each activity, use Get meta data activity again for that individual file and get the file size
    3. Use If activity to check whether the size is less than your ask and then use delete activity to delete that file

    Note: This seems to be a crude way but the way which I can think of