We do exactly the same thing, but we download the files first then use a for each loop to process them all.
We use a script task with the following code, which uses a static variable to set the path to download to.
Hopefully should be easy enough to understand the below
/*
Microsoft SQL Server Integration Services Script Task
Write scripts using Microsoft Visual C# 2008.
The ScriptMain is the entry point class of the script.
*/
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
namespace ST_346acc0b5c1843a7be32c7b7990d107a.csproj
{
[System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
{
#region VSTA generated code
enum ScriptResults
{
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
};
#endregion
public void Main()
{
// TODO: Add your code here
Microsoft.SqlServer.Dts.Runtime.HttpClientConnection httpConn;
Object obj;
String strSourceFileFullPath;
strSourceFileFullPath = Dts.Variables["v_strSourceZipFileFullpath"].Value.ToString();
try
{
obj = Dts.Connections["HTTP Connection Manager"].AcquireConnection(null);
httpConn = new HttpClientConnection(obj);
httpConn.DownloadFile(strSourceFileFullPath, true);
}
catch (Exception e)
{
Dts.Events.FireError(1, e.TargetSite.ToString(), e.Message, "", 0);
}
// TODO: Add your code here
Dts.TaskResult = (int)ScriptResults.Success;
}
}
}