question

arkiboys avatar image
0 Votes"
arkiboys asked MartinJaffer-MSFT edited

archive the files

The archive copy activity settings is shown below.

Question:
The files (For example: file1.csv, file2.csv, etc.) do get moved into the archive folder, but I would like to rename them in the archive folder as follows
file1_20210921.csv
file2_20210921.csv
file3_20210921.csv

Can you see what I need to do in the archive copy activity settings to achieve this?

Thank you
134022-image.png
134041-image.png
134042-image.png


azure-data-factory
image.png (46.6 KiB)
image.png (26.9 KiB)
image.png (39.1 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MartinJaffer-MSFT avatar image
0 Votes"
MartinJaffer-MSFT answered arkiboys commented

Hello again @arkiboys .

Looks like you have already parameterized the dataset and copy activity, and just need the expression to change the name in sink.

You currently have
@item().EntityName

I am guessing the _20210921 part of file1_20210921.csv is a date.
To make all the files have the same date, we need to get from the same source.
Make a Set Variable activity in beginning of pipeline with expression:

 @concat(
     '_',
     formatDateTime(UTCnow(),'yyyyMMdd')
 )

This makes "_20210922" .

Next to splice this date into the existing file name.

 @concat( 
     split(item().EntityName,'.')[0],
     variables('theDate'),
     '.',
     split(item().EntityName,'.')[1]
 )

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.