从文件夹中过滤文件

问题描述 投票:0回答:1

假设我有 5 个不同的文件夹,每个文件夹内有 10 个文件。现在我必须从每个文件夹中仅提取单个文件,并且这些文件需要用作复制数据活动的源(ADLS Gen2)并加载到目标(SQL 表)中。我需要通过使用过滤器活动条件来实现这一点。那么我如何为多个文件夹中的多个文件编写该条件

我尝试在 Filter 活动中编写表达式 @endswith(item().name,'_Filter.txt','_Condition.txt','_Env.txt','_escape.txt','_name.txt')。但它会抛出错误,因为函数结束时不接受 5 个参数。

azure
1个回答
0
投票

在 Filter 活动中使用endsWith 函数从多个文件夹中过滤多个文件的正确表达式是:

@or(or(or(or(endsWith(item().name, '_Filter.txt'),
    endsWith(item().name, '_Condition.txt')),endsWith(item().name, '_Env.txt')),endsWith(item().name, '_escape.txt')),endsWith(item().name, '_name.txt'))

您给出的表达式有

endsWith()
函数的多个参数。以上是满足您要求的正确方法。

© www.soinside.com 2019 - 2024. All rights reserved.