如何将多个文件扩展名添加到文件:Foreach 循环容器 SSIS 中的输入字段 [英] How to add multiple file extensions to the Files: input field in the Foreach loop container SSIS

查看:22
本文介绍了如何将多个文件扩展名添加到文件:Foreach 循环容器 SSIS 中的输入字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将多个文件扩展名添加到文件:SSIS 2008 中 Foreach 循环容器中的输入字段.

How could I add multiple file extensions to the Files: input field in the Foreach loop container in SSIS 2008.

我目前以 *.zip.csv 的形式输入,请参阅图片...但它仅在我有一个像 * 这样的值时才有效.zip

I have currently entered as *.zip OR .csv see image... but it doesn not work only works if I have one value like *.zip

推荐答案

我不认为你可以在 For each Loop container 中指定两个文件类型扩展名,你应该使用 *.* 并且您可以使用以下步骤过滤特定扩展名:

I don't think you can specify two file type extensions in a For each Loop container , you should use *.* and you can filter for a specific extensions by using the following steps:

  1. 添加一个布尔类型的变量(例如:User::Flag)
  2. 在容器内添加一个script task,并将Filename变量标记为Readonly,Flag变量标记为ReadWrite
  1. add a Variable of type boolean (ex: User::Flag)
  2. add a script task inside the container and mark Filename variable as Readonly , Flag variable as ReadWrite

  1. 在脚本里面写如下脚本

  1. Inside the script write the following script

Public Sub Main()

    Dim strFile As String = Dts.Variables.Item("Filename").Value.ToString

    Select Case IO.Path.GetExtension(strFile).ToLower
        Case ".csv", ".zip"
            Dts.Variables.Item("Flag").Value = True


        Case Else
            Dts.Variables.Item("Flag").Value = False
    End Select


    Dts.TaskResult = ScriptResults.Success
End Sub

  • Script task 输出连接器添加一个表达式,如下所示

  • Add an expression to the Script task output connector like shown below

    或者您可以通过使用诸如 带正则表达式的 Foreach 文件枚举器

    这篇关于如何将多个文件扩展名添加到文件:Foreach 循环容器 SSIS 中的输入字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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