0

I have a simple FTP connection and I'm trying to get the timestamp on one of the files, but it's returning the wrong datetime. When I breakpoint and hover over fileinfo, it says "9/13/2017 11:01:14 PM". But I can see in FileZilla that the last modified date is "9/14/2017 12:01:00 AM".

C#:

FTPRequest = (FtpWebRequest)FtpWebRequest.Create("ftp://62.225.166.49/US-Sync/DailyBuilds/iTWO_5_4/setup_complete_en_64.7z");
FTPRequest.Credentials = new NetworkCredential("rib-au", "9crT2Y2w");
FTPRequest.UseBinary = true;
FTPRequest.UsePassive = true;
FTPRequest.KeepAlive = true;
FTPRequest.Method = WebRequestMethods.Ftp.GetDateTimestamp;
FTPResponse = (FtpWebResponse)FTPRequest.GetResponse();
var fileinfo = FTPResponse.LastModified;

FileZilla:

FileZilla

  • Why do you think that FileZilla is right and `FtpWebRequest` is wrong? – Martin Prikryl Sep 15 '17 at 16:25
  • Do you have a shell access to the server? What is the actual timestamp of the file? Show us FileZilla and [`FtpWebRequest` verbose log files](https://stackoverflow.com/q/9664650/850848). – Martin Prikryl Sep 15 '17 at 16:27
  • Thanks, you sent me on the right track by not assuming FileZilla is correct. It turns out my code is giving me the timestamp of the containing folder -- not the file. That's good enough for what I need. Thanks for the help! – Christian Boyer Sep 18 '17 at 16:13
  • Are you sure? It would be quite a coincidence that the file and its folder have timestamps *exactly* 1 hour apart. – Martin Prikryl Sep 18 '17 at 17:43

0 Answers0