Downloading files based on most recent date and timestamp I have a requirement to download zipped files from an SFTP site using C# and Script Task within SSIS.

We have multiple files on the server with the same name, but with different date and timestamps.

Is there a way download the files based on most recent date and timestamp?
As the answer by @MarkSinkinson shows, you can use WinSCP .NET assembly.

There is an official example on WinSCP site for downloading the most recent file.

As it shows, to select and download the most recent file, use: 

// Get list of files in the directory
RemoteDirectoryInfo directoryInfo = session.ListDirectory(remotePath);

// Select the most recent file
RemoteFileInfo latest =
    directoryInfo.Files
        .Where(file =&gt; !file.IsDirectory)
        .OrderByDescending(file =&gt; file.LastWriteTime)
        .FirstOrDefault();

// Any file at all?
if (latest == null)
{
    throw new Exception("No file found");
}

// Download the selected file
session.GetFiles(RemotePath.EscapeFileMask(remotePath + latest.Name), localPath).Check();


For a full code, see the link.

See also the article on using the WinSCP .NET assembly from SSIS.

(I'm the author of WinSCP)