Share via

Replicating Directory Structures Between Blob Containers

PS 401 Reputation points
2023-11-10T19:14:02.01+00:00

Is there an easy way to replicate the directory structure from one Azure Blob Container to another with a recursive option enabled? Specifically, I want to copy the directory structure from BC1 hosted in RG1 to BC2 hosted in RG2.

Thank you!

Azure Data Lake Storage
Azure Data Lake Storage

An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.

Azure Storage
Azure Storage

Globally unique resources that provide access to data management services and serve as the parent namespace for the services.

Azure Blob Storage
Azure Blob Storage

An Azure service that stores unstructured data in the cloud as blobs.


2 answers

Sort by: Most helpful
  1. Siva Villa 285 Reputation points Microsoft Employee Moderator
    2023-11-27T03:46:14.18+00:00

    @PS

    The following PowerShell script facilitates the selective copying of containers from one storage account to another, excluding the data.

    https://github.com/Azure-Developer-Support/CodeRepository/blob/master/Storage/Powershell/CopyOnlyContainerFromOneStorageAccountToAnother.ps1

    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

  2. Gordon Byers 7,165 Reputation points
    2023-11-10T19:59:02.4233333+00:00

    You can use AZ Copy sync to replicate one container to the other, just make sure to set the recursive option.

    Download and Install AZ copy tool from here: https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-v10#download-azcopy

    azcopy sync 'https://<source-storage-account-name>.blob.core.windows.net/<container-name>/<SAS-token>' 'https://<destination-storage-account-name>.blob.core.windows.net/<container-name>' --recursive
    

    Ref: https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-blobs-synchronize#update-a-container-with-changes-in-another-container

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.