Using SSIS to retrieve the most recent file via ftp

Posted on 2009-02-11
Last Modified: 2013-11-10
I am currently using SSIS for loading data feeds via ftp and need to query the ftp site to ensure that the file being downloaded is the latest file when compared to the previously downloaded file that has the same name, whose time stamp is persisted in the database. My question - is there a way to retrieve the time stamp from a file located on the ftp site prior to downloading it. Essentially I want to compare timestamps prior to making a decision to download. For example if the time stamp on the ftp site for file x is greater than that of file x which was downloaded the day before then download file. I figured I would need to use a script task instead of the ftp task. Any help would be greatly appreciated.
Question by:Khopkins32
    LVL 22

    Expert Comment

    I know how can you get the file attributes after download the file from ftp server... before I dont know if it's possible... maybe by .net code inside a script...
    LVL 17

    Accepted Solution

    The only way I know is to use a third part tool for .net, like Rebex
    Here is their sample to get modified date. This could be used in a Script Task.
    ' select the desired directory

    ' retrieve and display the list of files and directories
    Dim list As FtpList = ftp.GetList()
    Dim item As FtpItem
    For Each item In list
        Console.Write(item.Size.ToString().PadLeft(10, ""c))
        Console.Write(" {0}", item.Name)
    Next item

    Author Comment

    This would work perfectly. Do you know if there is a freeware version of this. I would like to avoid have to pay for third party tool. But nonetheless, this is a good start

    Author Closing Comment

    Thanks for your help on this. I was actually able to find a shareware solution for this. This solution definitely pointed me in the right direction. Thank you
    LVL 17

    Expert Comment

    I would like to see your solution, please share when you can. Thanks.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    The steps for moving the system databases to a new location are documented in the following technical article: However sometimes after the moving process is finished, though SQL i…
    This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
    Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
    Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now