misdevelopment
asked on
FTP files using SSIS script task.
I have a requirement in SSIS to connect to a remote ftp site, download all files to a local drive and then remove only the remote files that I've transferred. The file names will be different each time.
I've got the attached code in a script task in my SSIS package:
Which always gives me the following error:
Exception from HRESULT: 0xC0016031
at Microsoft.SqlServer.Dts.Ru ntime.Wrap per.IDTSFt pClientCon nection90. ReceiveFil es(String[ ] remoteFileNames, String localPath, Boolean overWrite, Boolean transferASCII)
at Microsoft.SqlServer.Dts.Ru ntime.FtpC lientConne ction.Rece iveFiles(S tring[] remoteFileNames, String localPath, Boolean overwrite, Boolean isTransferAscii)
at ScriptTask_613a13b6b4eb4c4 1bb9ab2fb7 e238a98.Sc riptMain.M ain()
Files exist and the connection appears to be made...
Am I missing something obvious here?
JC
I've got the attached code in a script task in my SSIS package:
Which always gives me the following error:
Exception from HRESULT: 0xC0016031
at Microsoft.SqlServer.Dts.Ru
at Microsoft.SqlServer.Dts.Ru
at ScriptTask_613a13b6b4eb4c4
Files exist and the connection appears to be made...
Am I missing something obvious here?
JC
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
Public Class ScriptMain
Public Sub Main()
' Try
Dim cm As ConnectionManager = Dts.Connections.Add("FTP")
cm.Properties("ServerName").SetValue(cm, "******")
cm.Properties("ServerUserName").SetValue(cm, "*******")
cm.Properties("ServerPassword").SetValue(cm, "******")
cm.Properties("ServerPort").SetValue(cm, "21")
cm.Properties("Timeout").SetValue(cm, "0")
cm.Properties("ChunkSize").SetValue(cm, "1000") '1000 kb
cm.Properties("Retries").SetValue(cm, "1")
Dim ftp As FtpClientConnection = New FtpClientConnection(cm.AcquireConnection(Nothing))
ftp.Connect()
Dim fileNames() As String
Dim folderNames() As String
ftp.GetListing(folderNames, fileNames)
ftp.ReceiveFiles(fileNames, "o:\pods\", True, True)
'ftp.DeleteFiles(fileNames)
ftp.Close()
'Catch ex As Exception
' Dts.TaskResult = Dts.Results.Failure
'End Try
'Dts.TaskResult = Dts.Results.Success
End Sub
End Class
ASKER
I feel silly.
I didn't set the working directory to "/outgoing"
Nothing to see here :-)
Thanks,
JC
I didn't set the working directory to "/outgoing"
Nothing to see here :-)
Thanks,
JC
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Error: 0xC0016031 at Package, Connection manager "{867A9FF2-E663-4F72-BA5D-
Which is suggesting that no files are being picked up from getlistings.... or that I'm not passing them to the string array properly? Hmmmmm anyone?