获取子文件夹Azure数据工厂中的所有文件名 [英] Get all files names in subfolders Azure Data factory

查看:43
本文介绍了获取子文件夹Azure数据工厂中的所有文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Data湖中有一个下面的文件夹结构,我想从ParentFolder目录的所有子文件夹中获取所有.csv文件名.我所有的文件都是.csv文件,有没有一种使用Metadata活动的简单方法.

I have a below Folder Structure in Data lake, I want to get all .csv file names from all subfolders of my ParentFolder directory. All my files are .csv files is there a simple approach to do using Metadata activity.

ParentFolder>Year = 2020文件夹

ParentFolder > Year=2020Folder

          2020-10-20Folder > 2020-10-20.csv

          2020-10-21Folder > 2020-10-21.csv

          2020-10-22Folder > 2020-10-22.csv

推荐答案

我已经进行了测试,以成功获取文件名.

I've made a test to get the FileNames successfully.

我创建了与您相同的文件结构.

I created the same file structure as yours.

  1. 在ADF中,我们可以定义一个Array类型变量,以便以后存储文件名.

  1. 这是管道的摘要.

在GetMetaData1活动中,让我们定义根文件夹 2020Folder 的数据集.然后,我们使用 Child Items 来获取所有子文件夹.

At the GetMetaData1 activity, let's define a DataSet of the root folder 2020Folder. Then we use Child Items to get all the subfolders.

  1. 在ForEach1活动中,我们可以使用表达式 @activity('Get Metadata1').output.childItems 列出文件夹列表.
  1. At the ForEach1 activity, we can use the expression @activity('Get Metadata1').output.childItems to foreach the Folder list.

  1. 在ForEach1活动中,我们可以添加动态内容 @item().name ,以将子文件夹名称传递给GetMetadata2活动.然后,我们可以使用GetMetadata2活动从子文件夹中获取 Child Items .
  1. In the ForEach1 activity, We can add dynamic content @item().name to pass the subfolder name to the GetMetadata2 activity. Then we can use the GetMetadata2 activity to get the Child Items from the subfolder.

  1. 在Append变量活动中,我们可以使用我们先前定义的数组变量 FileNames 来存储所有文件名.在这里,我们使用表达式 @activity('Get Metadata2').output.childItems [0] 来获取文件名.
  1. At the Append variable activity, we can use the array variable FileNames we defined previously to store all the filenames. Here we use expression @activity('Get Metadata2').output.childItems[0] to get the filename.

  1. 最后.我们可以定义另一个Array类型变量来存储和查看结果.

我们可以看到数组的输出.

The output we can see the array.

这篇关于获取子文件夹Azure数据工厂中的所有文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆