简体   繁体   English

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

[英]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. 在我继续之前,我想回答这些问题。

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

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.

相关问题 通过FTP从Windows发送命令到linux - Send command via FTP from windows to linux 如何使用linux shell命令将整个目录上传到ftp服务器? - How to use linux shell command to upload entire directory to ftp server? 如何设置Linux服务器Wordpress插件或主题下载服务器询问FTP主机名,FTP用户名,FTP密码。 - How to Set Linux server Wordpress Plugin or Themes download server ask FTP hostname , FTP Username , FTP password .? 如何删除Windows发送到Perl中Linux FTP服务器的w文件中的^ M(CRLF)? - How to remove ^M (CRLF) from w file sent from Windows to linux FTP server in perl? 如何在 Linux 中保存 FTP session 文件中的日志 - How to save FTP session logs in file in Linux FTP Get在Windows上有效,但在Linux上不可用 - FTP Get works on windows but not on linux LINUX:如何检测ftp文件上传完成 - LINUX: how to detect that ftp file upload is finished 通过FTP命令或带有FTP命令的Shell脚本上传到Linux服务器后的TAR大小差异 - TAR size difference after uploading to Linux server via FTP command or a shell script with FTP command 如何在浏览器的FTP服务器上下载文件? - How I download file on FTP server in browser? FTP从Windows上传到Linux服务器时附加的CRLF标签 - CRLF tags attached upon FTP upload from a windows to Linux Server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM