swad
swad

Reputation: 87

Azure Data Factory: How to rename blob csv or text file in blob storage during copy or import?

I have some csv file name "Hist_Firms202006221017.csv" in my local machine. I need to upload it in Azure BLOB with new name "Hist_Firms". Basically i need to trim the timestamp part in copy data of azure Pipeline. Can someone help me with example and screen shot.

Upvotes: 1

Views: 3568

Answers (1)

Leon Yue
Leon Yue

Reputation: 16401

You could reference my steps. My file is in blob storage with the same "Hist_Firms202006221017": enter image description here

1. Using Get Metadata to get the file name: enter image description here

2. In copy active, the same source with Get Metadata: enter image description here

3. Copy active Sink dataset settings, add a parameter "filename": enter image description here

4. Copy active Sink settings: using expression to build the new file name "Hist_Firms":

@concat(substring(activity('Get Metadata1').output.itemname,0,10),'.csv')

enter image description here

5. Run the pipeline: enter image description here

6. File check: enter image description here

The difference is my source dataset is in Blob Storage, please change to your file location.

Hope this helps.

Upvotes: 2

Related Questions