How to get a file's date before downloading the ftp file

  • Thread starter Thread starter neibala
  • Start date Start date
N

neibala

Guest
Group

I am in a project where we are downloading the file from an ftp without any problem, only that it was asked to get the date that the file was made available on the ftp, for internal control purposes, in this case how I would be able to do this part to obtain the date that the file was made available within ftp?

Where I am sending part of the code to get a sense of how it has been done so far.
conect(origem);
ftp.Method = WebRequestMethods.Ftp.DownloadFile;

using (FtpWebResponse response = (FtpWebResponse)ftp.GetResponse())
{
using (Stream rs = response.GetResponseStream())
{
using (FileStream ws = new FileStream(destinoLocal, FileMode.Create))
{
byte[] buffer = new byte[2048];
int bytesRead = rs.Read(buffer, 0, buffer.Length);
while (bytesRead > 0)
{
ws.Write(buffer, 0, bytesRead);
bytesRead = rs.Read(buffer, 0, buffer.Length);
}
}
}
}

ftp.Abort();

Continue reading...
 
Back
Top