Reputation: 841
Its soounds simple but proving to be a headache . How can i do this ? My initial idea was to use a bat file and then add it as a task in SSIS .
Problem is that copy, xcopy or robcopy does not work ?
robocopy "http://wpcfs.corp.xx.com/xxx/xxx/BEP/xxx/documents/EB%20Bus%20Ops%20Points%20of%20Contact.xlsx" "C:\Imports\"
Any ideas ?
Upvotes: 1
Views: 2904
Reputation: 10241
You can use wget for windows to download the file
check this
after installing wget,
wget URL
will download the file in current directory
Upvotes: 0
Reputation: 8395
If you want to download from a website then you can use a SSIS script to download the files either via WebClient, WebRequest, or through the HTTP Connection Manager. There's a pretty thorough example of downloading via the HTTP Connection Manager on this blog. The blog comments also includes code that I listed below that downloads the data via WebRequest/WebResponse. You could also use the more straight forward WebClient, but I found I had problems using the WebClient to download really large files that I was able to avoid with the WebRequest/WebResponse approach.
Imports System.IO
Imports System.Net
Imports System.Text
Imports System.Web
Public Class WebRetrieve
Public Shared Sub Main()
Dim wr As HttpWebRequest = CType(WebRequest.Create("https://reports/reports.txt"), HttpWebRequest)
Dim ws As HttpWebResponse = CType(wr.GetResponse(), HttpWebResponse)
Dim str As Stream = ws.GetResponseStream()
Dim inBuf(100000000) As Byte
Dim bytesToRead As Integer = CInt(inBuf.Length)
Dim bytesRead As Integer = 0
While bytesToRead > 0
Dim n As Integer = str.Read(inBuf, bytesRead, bytesToRead)
If n = 0 Then
Exit While
End If
bytesRead += n
bytesToRead -= n
End While
Dim fstr As New FileStream("c:\New\reports.txt", FileMode.OpenOrCreate, FileAccess.Write)
fstr.Write(inBuf, 0, bytesRead)
str.Close()
fstr.Close()
End Sub
End Class
Upvotes: 2