Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Download file from webpage with script task
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

South Africa
4 Posts

Posted - 04/30/2015 :  08:35:23  Show Profile  Reply with Quote

I'm trying to
- download all the files on a webpage where the file name is like "cust_interact" (eg cust_interact.0815, cust_interact.0615)
(or even better, read the file date and only download today's)
- save it locally with file name and date

They are not in a specific folder but directly under They're in the root directory

This is my code, which naturally makes total sense to me and only me!

Public Sub Main()

Dim strtemp As String = "\\Server\folder\folder2\folder3\CustInteraction"
Dim strsource As String = ""
Dim webunibase As New WebClient
Dim strdestnew As String = InStr(1, "cust_interact", strsource)
Dim strdest As String = strtemp + Date.Now.ToString("yyyyMMddhhmm") + ".csv"

For Each strdest In strdestnew
webunibase.DownloadFile(strsource, strdest)

Dts.TaskResult = ScriptResults.Success
End Sub


Edited by - enslinb on 04/30/2015 09:28:47

Flowing Fount of Yak Knowledge

2780 Posts

Posted - 04/30/2015 :  10:19:22  Show Profile  Reply with Quote
Good for you! Though I would probably not hard-code the source or destination strings, but rather pass them to the script as variables which are configurable via SSIS Package Configurations.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2019 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000