I have to download the latest file from an FTP server. I know how download the latest file from my computer, but I don't how download from an FTP server.
How can I download the latest file from a FTP server?
This is my program to download the latest file from my Computer
string startFolder = @"C:\Users\user3\Desktop\Documentos XML";
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(startFolder);
IEnumerable<System.IO.FileInfo> fileList =
dir.GetFiles("*.*", System.IO.SearchOption.AllDirectories);
IEnumerable<System.IO.FileInfo> fileQuerry =
from file in fileList
where file.Extension == ".txt"
orderby file.CreationTimeUtc
select file;
foreach (System.IO.FileInfo fi in fileQuerry)
{
var newestFile =
(from file in fileQuerry
orderby file.CreationTimeUtc
select new { file.FullName, file.Name })
.First();
textBox2.Text = newestFile.FullName;
}
OK, with this code I know the date of the last file, but How I know the name of this file????????