How to resolve date format returned by FTP file listing commands?

StackOverflow https://stackoverflow.com/questions/23559233

  •  18-07-2023
  •  | 
  •  

Вопрос

I am using an FTP server which, while listing the files using e.g. ls command, returns the last modification date in following format:

05/06/12

Is there a way to know what date format the remote server is using?

Это было полезно?

Решение

There is no definition about date format in the listings, it is not even defined that the listings should include the date at all. So you can only guess if you need to parse the listing. For a reliable and defined way to get the modification time of a file use the MDTM command. Unfortunately you need to send this for each file which could make everything slower.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top