I could not find the exact details on how to create a SSIS script that would ftp files on these forums, so I am adding my code to help save time for anyone else that might be wanting to do something similar. Here is the VB code for my script task to FTP files (hope this helps someone):
' Microsoft SQL Server Integration Services Script Task
' Write scripts using Microsoft Visual Basic
' The ScriptMain class is the entry point of the Script Task.
Imports
SystemImports
System.DataImports
System.MathImports
Microsoft.SqlServer.Dts.RuntimePublic
Class ScriptMainPublicSub Main()Try'Create the connection to the ftp serverDim cm As ConnectionManager = Dts.Connections.Add("FTP")'Set the properties like username & passwordcm.Properties(
"ServerName").SetValue(cm, "Enter your Server Name here")cm.Properties(
"ServerUserName").SetValue(cm, "Enter your FTP User Name here")cm.Properties(
"ServerPassword").SetValue(cm, "Enter your FTP Password here")cm.Properties(
"ServerPort").SetValue(cm, "21")cm.Properties(
"Timeout").SetValue(cm, "0") 'The 0 setting will make it not timeoutcm.Properties(
"ChunkSize").SetValue(cm, "1000") '1000 kbcm.Properties(
"Retries").SetValue(cm, "1")'create the FTP object that sends the files and pass it the connection created above.Dim ftp As FtpClientConnection = New FtpClientConnection(cm.AcquireConnection(Nothing))'Connects to the ftp serverftp.Connect()
'Build a array of all the file names that is going to be FTP'ed (in this case only one file)Dim files(0) AsStringfiles(0) =
"Drive:\FullPath\YourFileName"'ftp the file 'Note: I had a hard time finding the remote path directory. I found it by mistake by creating both the FTP connection and task in the SSIS package and it defaulted the remote path setting in the FTP task.ftp.SendFiles(files,
"/Enter Your Remote Path", True, False) ' the True makes it overwrite existing file and False is saying that it is not transferring ASCIIftp.Close()
Catch ex As ExceptionDts.TaskResult = Dts.Results.Failure
EndTryDts.TaskResult = Dts.Results.Success
EndSub
End
Class