0

VB で Scipt タスクを使用する SSIS パッケージ (以下のコードを参照) と Http 接続マネージャーを使用して、1 つの定義済み .zip ファイルをダウンロードします。私が望んでいて理解できないのは、同じ場所にあるすべての .zip ファイルをループしてダウンロードすることです。

どんな提案でも大歓迎です。

ビジュアル B は次のとおりです。

    Imports System
    Imports System.IO
    Imports System.Text
    Imports System.Windows.Forms
    Imports Microsoft.SqlServer.Dts.Runtime

     Public Sub Main()
    '
    ' Get the unmanaged connection object, from the connection manager called "HTTP Connection Manager"
    Dim nativeObject As Object = Dts.Connections("HTTP Connection Manager").AcquireConnection(Nothing)

    ' Create a new HTTP client connection
    Dim connection As New HttpClientConnection(nativeObject)


    ' Download the file #1
    ' Save the file from the connection manager to the local path specified
    Dim filename As String = "C:\Users\{CurrentUser}\Documents\file.zip"
    connection.DownloadFile(filename, True)

    ' Confirm file is there
    If File.Exists(filename) Then
        MessageBox.Show(String.Format("File {0} has been downloaded.", filename))
    End If


    ' Download the file #2
    ' Read the text file straight into memory
    Dim buffer As Byte() = connection.DownloadData()
    Dim data As String = Encoding.ASCII.GetString(buffer)

End Sub
4

1 に答える 1