I need to Maintain Folder Structure to store files in yyyy/MM/DD format and I am getting date like this "2021-12-01T00:00:00Z" I need to Extract year from the date and to store in one variable and need to extract Month from date and set to another variable and for Date as well so that I will Concat these variable result under Copy activity Sink section
2
Answers
Yes , you can Maintain Folder Structure by using Split .
Inside Year,Month,Date. Add this dynamic content value :
Year:
@split(pipeline().parameters.fileName,'-')[0]
Month:
@split(pipeline().parameters.fileName,'-')[1]
Data:
For more information refer this JSON Code representation.
Output:
Use a metadata activity to get the file list, and then a foreach activity to copy each file to the appropriate folder:
Metdata activity setting:
On foreach activity, in items loop through all the child items –
Inside the foreach look, add a copy activity to copy each file:
Source:
Source dataset (with a parameter on filename, to copy one file only:
Sync settings:
Expression to pass to folder parameter:
Sync dataset, with a parameter on folder name to create the hierarchy:
The result: