[英]FTP “ls -lt” command: How does it list the file details for Linux FTP and Windows FTP server?
I am writing FTP client that should work for at least Windows and Linux FTPs. 我正在编写FTP客户端,至少应该适用于Windows和Linux FTP。 BUt before I proceed, I want answer to these questions.
在我继续之前,我想回答这些问题。
ls -lt
command is used for the FTP server on the Linux ? ls -lt
命令用于Linux上的FTP服务器时,列出了哪些顺序文件? ls -lt
command is used for the FTP server on the Windows ? ls -lt
命令用于Windows上的FTP服务器时,列出了哪些顺序文件? Note: I tried command on Windows and Linux FTP servers but I could not figure out any specific logic/format. 注意:我尝试在Windows和Linux FTP服务器上执行命令,但我无法找出任何特定的逻辑/格式。
ls
is a client command. ls
是一个客户端命令。 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. 当您的客户端从用户获取
ls -lt
,您向服务器发出LIST
命令,由您的客户端来解析返回的数据并按时间对其进行排序。 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. 使用
LIST
命令时ftp服务器返回的数据类似于ls
的输出,但它可能因服务器而异。 See: http://cr.yp.to/ftp/list.html 请参阅: http : //cr.yp.to/ftp/list.html
The format of the FTP ls / dir commands is server implementation dependent. FTP ls / dir命令的格式取决于服务器实现。 It is unlikely you could rely on the order of an ls -lt command within ftp.
您不太可能依赖ftp中ls -lt命令的顺序。 Some server implementations may give you name order, others may give you time order.
某些服务器实现可能会为您提供名称顺序,其他服务器实现可能会为您提
Newer FTP servers should hopefully implement RFC 3659, particularly the MLSD and MLST commands. 较新的FTP服务器应该有望实现RFC 3659,特别是MLSD和MLST命令。 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.
这些命令的响应格式 - 用于以机器可解析的格式列出文件和目录 - 由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; 不幸的是,MLSD / MLST命令在处理响应格式时,并不保证列表中文件的排序; that is something that your client would need to handle.
这是您的客户需要处理的事情。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.