I\'m looking for a short bit of sample code which uses the System.Net.FtpWebRequest namespace to get the timestamp of a specified remote file on an ftp server. I know I need
Something like this:
DateTime DateValue;
FtpWebRequest Request = (FtpWebRequest)WebRequest.Create(yourUri);
Request.Method = WebRequestMethods.Ftp.GetDateTimestamp;
Request.UseBinary = false;
using (FtpWebResponse Response = (FtpWebResponse)Request.GetResponse())
using (TextReader Reader = new StringReader(Response.StatusDescription))
{
string DateString = Reader.ReadLine().Substring(4);
DateValue = DateTime.ParseExact(DateString, "yyyyMMddHHmmss", CultureInfo.InvariantCulture.DateTimeFormat);
}