We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

Using SSIS to retrieve the most recent file via ftp

Khopkins32
Khopkins32 asked
on
Medium Priority
1,697 Views
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.
Comment
Watch Question

Commented:
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...
CERTIFIED EXPERT
Commented:
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
ftp.ChangeDirectory("path")

' 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.Modified.ToString("u"))
    Console.Write(item.Size.ToString().PadLeft(10, ""c))
    Console.Write(" {0}", item.Name)
    Console.WriteLine()
Next item
 

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
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

Commented:
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
CERTIFIED EXPERT

Commented:
I would like to see your solution, please share when you can. Thanks.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.