FTP details command doesn't seem to return the year the file was modified, is there a way around this?

强颜欢笑 提交于 2021-01-28 10:50:27

问题


I have a program that needs to download a file from ftp with the latest modified date.

I have the usual code to connect and I use this method.

request.Method = WebRequestMethods.Ftp.ListDirectoryDetails;

The data that comes back looks like:

-rw-r--r--  1 myftp  cats  1691090 Jan  6 20:52 somefile.zip

There is no year component here so I can't use this date for comparison because it'll fail once we get to December and it rolls around to january.

Any ideas? The FTP server is a 3rd party so I can't make any changes to it.


回答1:


These example appears to be following the same standard as the UNIXy ls -l command, which only shows the year for dates older than six months.

If that's the case, you could infer the year easily but you should be aware that the format isn't guaranteed, it probably depends on the underlying OS the FTP server is running on.



来源:https://stackoverflow.com/questions/20975109/ftp-details-command-doesnt-seem-to-return-the-year-the-file-was-modified-is-th

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!