Vompsis
Vompsis

Reputation: 11

Copy activity with simultaneous renaming of a file. From blob to blob

I have a "copy data" activity in Azure Data Factory. I want to copy .csv files from blob container X to Blob container Y. I don't need to change the content of the files in any way, but I want to add a timestamp to the name, e.g. rename it. However, I get the following error "Binary copy does not support copying from folder to file". Both the source and the sink are set up as binary.

Upvotes: 1

Views: 1418

Answers (1)

Leon Yue
Leon Yue

Reputation: 16401

If you want to copy the files and rename them, you pipeline should like this:

  1. Create a Get Metadata active to get the file list(dataset Binary1): enter image description here
  2. Create For Each active to copy the each file:@activity('Get Metadata1').output.childItems: enter image description here
  3. Foreach inner active, create a copy active with source dataset Binary2(same with Binary2) with dataset parameter to specify the source file: enter image description here
  4. Copy active sink setting, create the sink Binary3 also with parameter to rename the files: @concat(split(item().name,'.')[0],utcnow(),'.',split(item().name,'.')[1]): enter image description here
  5. Run the pipeline and check the output: enter image description here

Note: The example I made just copy the files to the same container but with new name.

Upvotes: 1

Related Questions