Home > SQL Server > Get the File Last Modified datetime from FTP Server – SSIS

Get the File Last Modified datetime from FTP Server – SSIS


There are many ways to get the file modified date from the FTP server. But, I like to write a VB.net code to do that task simpler. Script Task is used in SSIS.

Code: To fetch the file last modified datetime

Imports System.Net

Dim reqFTP As FtpWebRequest = DirectCast(FtpWebRequest.Create(New Uri(“ftp://SERVERName/FileName”)),  FtpWebRequest)

reqFTP.Method = WebRequestMethods.Ftp.GetDateTimestamp

reqFTP.Credentials = New NetworkCredential(“USER NAME”, “PASSWORD”)

response = DirectCast(reqFTP.GetResponse(), FtpWebResponse)

MsgBox(response.LastModified.ToString)

reqFTP.Abort()

Using Credentials is based on the server requirement. In this script, file date time is just displayed using Message box. We can use package variable to store the value.

Advertisements
Categories: SQL Server
  1. Meena
    June 19, 2015 at 4:56 am

    Even if free FTP software the cost to set it up and manage is too much. On the other hand, Binfer can be run on any computer without separate server or client components. See Binfer as FTP alternative

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: