azcopy copy ' https://mysourceaccount.blob.core.windows.net/mycontainer' ' https://mydestinationaccount.blob.core.windows.net/mycontainer' --recursive
The above will copy everything from one storage account to another. My requirement is that data should be organized in the target folder based on the last modified date of the files in the source container. The source container is one big directory with lots of files.
Suppose the files are like this in the source
https://mysourceaccount.blob.core.windows.net/mycontainer/file1 with last modified date of 2023-12-13
https://mysourceaccount.blob.core.windows.net/mycontainer/file2 with last modified date of 2023-12-14
https://mysourceaccount.blob.core.windows.net/mycontainer/file3 with last modified date of 2023-12-15
The target directory should be copied like below and this would involve creating the date path based on the source last modified date.
https://mydestinationaccount.blob.core.windows.net/mycontainer/2023/12/13/file1
https://mydestinationaccount.blob.core.windows.net/mycontainer/2023/12/15/file2
https://mydestinationaccount.blob.core.windows.net/mycontainer/2023/12/15/file3
Copying storage data from one Azure account to another and organize into date folders. You need to use get metadata activity. follow below steps:
Field list
as Child items@activity('Get Metadata1').output.childItems
.@item().name
andField list
as Last modified@item().name
and third dataset we created in sink and with dataset prameter for filename is@item().name
and folderpath is@formatDateTime(activity('Get Metadata2').output.lastModified,'yyyy/MM/dd')
-- Source:Output: