FTP“ls -lt”命令:它如何列出Linux FTP和Windows FTP服务器的文件详细信息?

时间:2022-07-28 03:46:30

I am writing FTP client that should work for at least Windows and Linux FTPs. BUt before I proceed, I want answer to these questions.

我正在编写FTP客户端,至少应该适用于Windows和Linux FTP。在我继续之前,我想回答这些问题。

  1. In which order files are listed when FTP ls -lt command is used for the FTP server on the Linux?
  2. 当FTP ls -lt命令用于Linux上的FTP服务器时,列出了哪些顺序文件?
  3. Is there any specific format/logic in which all Linux FTP servers provide the list of files? e.g. DateTime stamp is going to be there always and files are listed in the descending order of the "date modfied" or something like this.
  4. 是否有任何特定的格式/逻辑,其中所有Linux FTP服务器都提供文件列表?例如DateTime标记将始终存在,文件按“修改日期”的降序列出或类似这样。
  5. In which order files are listed when FTP ls -lt command is used for the FTP server on the Windows?
  6. 当FTP ls -lt命令用于Windows上的FTP服务器时,列出了哪些顺序文件?
  7. Is there any specific format/logic in which all Windows FTP servers provide the list of files?
  8. 是否有任何特定的格式/逻辑,其中所有Windows FTP服务器都提供文件列表?
  9. Can you direct me to some documentation which helps to understand this? Is there any standard defined for this?
  10. 你能指导我一些有助于理解这一点的文件吗?有没有为此定义的标准?

Note: I tried command on Windows and Linux FTP servers but I could not figure out any specific logic/format.

注意:我尝试在Windows和Linux FTP服务器上执行命令,但我无法找出任何特定的逻辑/格式。

3 个解决方案

#1


8  

ls is a client command. When your client gets ls -lt from the user, you issue a LIST command to the server and it's up to your client to parse the data returned and sort it by time. The data returned by the ftp server when you use the LIST command is similar to the output of ls, but it can vary from server to server. See: http://cr.yp.to/ftp/list.html

ls是客户端命令。当您的客户端从用户获取ls -lt时,您向服务器发出LIST命令,由您的客户端来解析返回的数据并按时间对其进行排序。使用LIST命令时ftp服务器返回的数据类似于ls的输出,但它可能因服务器而异。请参阅:http://cr.yp.to/ftp/list.html

#2


4  

The format of the FTP ls / dir commands is server implementation dependent. It is unlikely you could rely on the order of an ls -lt command within ftp. Some server implementations may give you name order, others may give you time order.

FTP ls / dir命令的格式取决于服务器实现。您不太可能依赖ftp中ls -lt命令的顺序。某些服务器实现可能会给您命名顺序,其他服务器实现可能会给您时间顺

#3


1  

Newer FTP servers should hopefully implement RFC 3659, particularly the MLSD and MLST commands. The format of the response for these commands -- used for listing files and directories, in a machine-parseable format -- is strictly defined by the RFC, and thus should will be the same across underlying platforms/OSes.

较新的FTP服务器应该有望实现RFC 3659,特别是MLSD和MLST命令。这些命令的响应格式 - 用于以机器可解析的格式列出文件和目录 - 由RFC严格定义,因此应该在底层平台/操作系统之间相同。

Unfortunately, the MLSD/MLST commands, while addressing the format of the responses, make no guarantee about the ordering of the files within a listing; that is something that your client would need to handle.

不幸的是,MLSD / MLST命令在解决响应格式时,不保证列表中文件的排序;这是您的客户需要处理的事情。

#1


8  

ls is a client command. When your client gets ls -lt from the user, you issue a LIST command to the server and it's up to your client to parse the data returned and sort it by time. The data returned by the ftp server when you use the LIST command is similar to the output of ls, but it can vary from server to server. See: http://cr.yp.to/ftp/list.html

ls是客户端命令。当您的客户端从用户获取ls -lt时,您向服务器发出LIST命令,由您的客户端来解析返回的数据并按时间对其进行排序。使用LIST命令时ftp服务器返回的数据类似于ls的输出,但它可能因服务器而异。请参阅:http://cr.yp.to/ftp/list.html

#2


4  

The format of the FTP ls / dir commands is server implementation dependent. It is unlikely you could rely on the order of an ls -lt command within ftp. Some server implementations may give you name order, others may give you time order.

FTP ls / dir命令的格式取决于服务器实现。您不太可能依赖ftp中ls -lt命令的顺序。某些服务器实现可能会给您命名顺序,其他服务器实现可能会给您时间顺

#3


1  

Newer FTP servers should hopefully implement RFC 3659, particularly the MLSD and MLST commands. The format of the response for these commands -- used for listing files and directories, in a machine-parseable format -- is strictly defined by the RFC, and thus should will be the same across underlying platforms/OSes.

较新的FTP服务器应该有望实现RFC 3659,特别是MLSD和MLST命令。这些命令的响应格式 - 用于以机器可解析的格式列出文件和目录 - 由RFC严格定义,因此应该在底层平台/操作系统之间相同。

Unfortunately, the MLSD/MLST commands, while addressing the format of the responses, make no guarantee about the ordering of the files within a listing; that is something that your client would need to handle.

不幸的是,MLSD / MLST命令在解决响应格式时,不保证列表中文件的排序;这是您的客户需要处理的事情。