使用 Azure 数据工厂复制多个容器中的文件Copy files from multiple containers with Azure Data Factory

适用于:是 Azure 数据工厂否 Azure Synapse Analytics(预览版)APPLIES TO: yesAzure Data Factory noAzure Synapse Analytics (Preview)

本文介绍一种解决方案模板,可用于从文件存储之间的多个容器复制文件。This article describes a solution template that you can use to copy files from multiple containers between file stores. 例如,可以使用模板将一个 Azure Blob 存储帐户中的所有内容复制到另一个 Azure Blob 存储帐户。For example, you could use the template to replicate everything from one Azure Blob storage account to another.

备注

若要复制单个容器中的文件,使用复制数据工具通过单个复制活动创建管道的做法会更有效。If you want to copy files from a single container, it's more efficient to use the Copy Data Tool to create a pipeline with a single copy activity. 本文中的模板超出了你对该简单方案的需求。The template in this article is more than you need for that simple scenario.

关于此解决方案模板About this solution template

此模板枚举源存储中的容器。This template enumerates the containers from your source storage store. 然后将这些容器复制到目标存储。It then copies those containers to the destination store.

该模板包含三个活动:The template contains three activities:

  • GetMetadata 扫描源存储并获取容器列表。GetMetadata scans your source storage store and gets the container list.
  • ForEach 获取 GetMetadata 活动提供的容器列表,然后循环访问该列表并将每个容器传递到 Copy 活动。ForEach gets the container list from the GetMetadata activity and then iterates over the list and passes each container to the Copy activity.
  • Copy 将源存储中的每个容器复制到目标存储。Copy copies each container from the source storage store to the destination store.

模板定义以下参数:The template defines the following parameters:

  • SourceFileFolder 是数据源存储的文件夹路径,在其中可以获取容器的列表。SourceFileFolder is the folder path of your data source store, where you can get a list of the containers. 该路径是包含多个容器文件夹的根目录。The path is the root directory, which contains multiple container folders. 此参数的默认值为 sourcefolderThe default value of this parameter is sourcefolder.
  • SourceFileDirectory 是数据源存储的根目录下的子文件夹路径。SourceFileDirectory is the subfolder path under the root directory of your data source store. 此参数的默认值为 subfolderThe default value of this parameter is subfolder.
  • DestinationFileFolder 是文件将复制到目标存储中的文件夹路径。DestinationFileFolder is the folder path where the files will be copied to in your destination store. 此参数的默认值为 destinationfolderThe default value of this parameter is destinationfolder.
  • DestinationFileDirectory 是文件将复制到目标存储中的子文件夹路径。DestinationFileDirectory is the subfolder path where the files will be copied to in your destination store. 此参数的默认值为 subfolderThe default value of this parameter is subfolder.

如何使用此解决方案模板How to use this solution template

  1. 转到“在文件存储之间复制多个文件容器”模板。Go to the Copy multiple files containers between File Stores template. 创建与源存储的连接。Create a New connection to your source storage store. 源存储是你要从多个容器复制文件的位置。The source storage store is where you want to copy files from multiple containers from.

    与源建立新的连接

  2. 创建与目标存储的连接。Create a New connection to your destination storage store.

    与目标建立新的连接

  3. 选择“使用此模板”。Select Use this template.

    使用此模板

  4. 你将看到管道,如以下示例所示:You'll see the pipeline, as in the following example:

    显示管道

  5. 选择“调试”,输入参数,然后选择“完成”。 Select Debug, enter the Parameters, and then select Finish.

    运行管道

  6. 查看结果。Review the result.

    查看结果

后续步骤Next steps