November 23, 2015 at 5:21 am
HI Champs,
I need to download txt files from HTTPS server , it contains many txt files need to download all of them.
How can i achieve this using script task ? can anybody share the code sample, am not a c# guy so facing lot of problem with this.
Thanks a lot in advance.
Regards,
Ravi
November 23, 2015 at 5:31 am
If you know the file name(s),there's quite a few articles on how to do this either via the SSIS component or a script task; i saw a lot in the search like this:
https://www.google.com/q=ssis+download+files+from+https
is the list a static list of files, or does it change over time, so you have to read one page or directory list to get the list of files, and then download the files form the list? that makes it a bit harder.
Lowell
November 23, 2015 at 5:39 am
Thanks for the quick reply. yes file names will be dynamic and need to fetch specific file names only which has some format in a floder .
November 23, 2015 at 6:09 am
ok, if it's dynamic, it a pain, but doable. so much of it depends on the page that is presented with the listof files, because you have to extract them all out.
i've done it like this:
In my case, i was downloading csv files.
I've used a script task to read a web page into a string.
i then parse the string with a regular expression to get all the a href="somefile" links.
i personally had to tweak the links because they were all relative, and i needed absolute:
ie the link said <a href="Invoice_2015_10_01.csv">Invoice_2015_10_01.csv</a>
but i needed the full path of http://website.com/Subdirectory/Invoice_2015_10_01.csv
that list went into a datatable, that i passed to the next script task; it could have been a delimited string, or a string array or a list of string, but that's just the way i did it.
the next item was a script task that downloaded each file in the datatable.
Lowell
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply