April 28, 2010 at 7:04 am
Hi,
I am writing an SSIS package where I am downloading files from FTP location. using Script task for some reason here is the code.. but it seems it's not downloading any file from ftp location. There is no error, when I debug the script task it is working sucessfully.
Your suggestion are appreciated.
Sample Code :
ftpCon.Properties("ServerName").SetValue(ftpCon, "IP Address")
ftpCon.Properties("ServerUserName").SetValue(ftpCon, "UserName")
ftpCon.Properties("ServerPassword").SetValue(ftpCon, "Password")
ftpCon.Properties("ServerPort").SetValue(ftpCon, "21")
ftpCon.Properties("Timeout").SetValue(ftpCon, "0")
Dim ftp As FtpClientConnection = New FtpClientConnection(ftpCon.AcquireConnection(Nothing))
Dim files(0) As String
files(0) = "/FTPFolder/*.bak"
http://ftp.ReceiveFiles(files, "C:/ftp", True, False)
Abhijit - http://abhijitmore.wordpress.com
February 7, 2011 at 5:26 am
Hi,
i am also having the same issue, Please let me know how you sort it out.
Thanks in advance
February 7, 2011 at 7:46 am
I do something very similar but slightly different where I build a comma separated string for the filenames before doing the ReceiveFiles command. I did not come up with this myself but it always works so it may be worth a shot.
ftpCon.Properties("ServerName").SetValue(ftpCon, "IP Address")
ftpCon.Properties("ServerUserName").SetValue(ftpCon, "UserName")
ftpCon.Properties("ServerPassword").SetValue(ftpCon, "Password")
ftpCon.Properties("ServerPort").SetValue(ftpCon, "21")
ftpCon.Properties("Timeout").SetValue(ftpCon, "0")
Dim ftp As FtpClientConnection = New FtpClientConnection(ftpCon.AcquireConnection(Nothing))
http://ftp.GetListing(foldernames, fileNames)
' http://ftp.GetListing(foldernames, fileNames)
'download the files
For Each fileName As String In fileNames
If fileComplete(fileName, fileName) = 0 Then 'file is done loading
If fileName.ToLower().Contains(".bak") Then
filesCSV = filesCSV + fileName + ","
filesToFTP(0) = fileName
http://ftp.ReceiveFiles(filesToFTP, "c:\ftp", True, False)
'ftpFile(fileName, fileName)
End If
End If
Next
February 7, 2011 at 10:26 pm
Hi Mike,
Thanks for your post.
Still my Script task runs fine without downloading the files to my local directory.
Let me know if we need to set the "write" permissions for the Local Folder for the "FTP" user name to write the files?
Any suggestions?
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply