Share via

Azure Function apps Function to rename file in Azure Data lake storage Gen 2

AzeemK 516 Reputation points
2021-08-31T21:56:20.777+00:00

I have few text files under Azure Data lake Storage Gen 2 raw container, I want to rename these file like strip some characters ProductIDs.20210623.075739.txt to ProductIDs.txt out of file name , also replace some characters inside the file using python or power shell , this really straight forward on prem file share, is there any good documentation on how to do that by using function in Azure Function App or any other simpler way from ADF pipeline??

Azure Functions
Azure Functions

An Azure service that provides an event-driven serverless compute platform.

Azure Data Factory
Azure Data Factory

An Azure service for ingesting, preparing, and transforming data at scale.

0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. ShaikMaheer-MSFT 38,636 Reputation points Microsoft Employee Moderator
    2021-09-01T16:28:47.663+00:00

    Hi @AzeemK ,

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

    You can achieve your requirement either using ADF or using Azure Function App.

    Requirement 1: Rename file name on ADLS Gen2

    1. Using Azure Data Factory Pipeline
      - Make API call to ADLS Gen2 using web activity. This API of ADLS Gen2 helps you to rename file name.
      - Have PowerShell code to rename file on ADLS Gen2 and execute that using Custom Activity. Click here for documentation of PowerShell library
    2. Using Azure Functions
      - Have Python or C# or PowerShell code to make REST API call to ADLS Gen2 to rename file.

    Requirement 2: Replace some characters inside file

    1. Using Azure Data Factory Pipeline
      - You need to consider data flows inside ADF to perform this transformation. replace() function will help to achieve this.
      - You can consider REST API call to ADLS Gen2 as well, to update file.
    2. Using Azure Functions
      - You can write your own code in Python or C# or PowerShell to make REST API call to ADLS Gen2 to update file.

    Click here for Azure data lake Gen2 REST APIs documentation.
    Click here to Azure data lake Gen2 PowerShell library documentation.

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

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

    Please do consider clicking on "Accept Answer" and "Up-vote" on the post that helps you, as it can be beneficial to other community members


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.