Hi, the code below works BUT only when i write the entire filename and .zip extension in the path (Bold & underlined section) and the problem im facing is that filenames somtimes change. so how do i get only .zip files without specifying the file name in a folder? Please help
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
<microsoft.sqlserver.dts.tasks.scripttask.ssisscripttaskentrypointattribute> _
<system.clscompliantattribute(false)> _
Partial Public Class ScriptMain
Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
Enum ScriptResults
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
End Enum
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, "")
cm.Properties("Timeout").SetValue(cm, "0")
cm.Properties("ChunkSize").SetValue(cm, "1")
cm.Properties("Retries").SetValue(cm, "")
Dim ftp As FtpClientConnection = New FtpClientConnection(cm.AcquireConnection(Nothing))
ftp.Connect()
Dim files(0) As String
files(0) = "K:\SISS\file2.zip"
'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, "/FtpRainbow", True, False) ' the True makes it overwrite existing file and False is saying that it is not transferring ASCII
ftp.Close()
Catch ex As Exception
Dts.TaskResult = ScriptResults.Failure
End Try
Dts.TaskResult = ScriptResults.Success
End Sub