Using wildcard characters to Delete the files

rajendar erabathini 616 Reputation points
2021-09-28T17:58:58.54+00:00

Hi - In my datalake 2.0 I need to delete the files which DO NOT end with number. In the below list of files i need to delete the highlighted files. I am using delete activity in my pipeline(ADF) with wildcard expression in file name "*[abcdefghijklmnopqurstuvwxyz]".

filenew.parquet
file12.parquet
fileold.parquet
file.parquet
file14.parquet
file10.parquet

However, its not working. How can I delete the files which DO NOT end with numbers. What are the wildcard characters need to use.

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
0 comments No comments
{count} votes

Answer accepted by question author
  1. ShaikMaheer-MSFT 38,556 Reputation points Microsoft Employee Moderator
    2021-09-29T07:49:02.17+00:00

    Hi @rajendar erabathini ,

    Thank you for posting query in Microsoft Q&A Platform.

    In Azure data factory, allowed wild cards are *(matches zero or more characters) and ?(matches zero or single character). you can use ^ to escape if your file name has a wildcard or this escape character inside. Click here to see more examples.

    Your case cannot able achievable using above wildcards in Azure data factory directly. Hence, you can leverage Azure functions may be to write a piece of code which filters filenames which don't have numbers in it.

    Pass output array of filtered file names from Azure functions to ForEach activity to loop each file name and use delete activity inside ForEach activity to dynamically point to the file in the iteration and delete it.

    You can use Azure Functions activity to run Azure function in Azure data factory.

    Hope this will help. Please let us know if any further queries. 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
    • 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
    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.