[英]How do I get and filter a list of files from TIdFTP?
I am trying to make a utility to scan our FTP site for old files. 我正在尝试制作一个实用程序来扫描我们的FTP站点中的旧文件。
I have come across Indy FTP as part of RAD Studio today and like how it works, but how do I do the following? 今天,作为RAD Studio的一部分,我遇到了Indy FTP,并且喜欢它的工作原理,但是我该怎么做?
TIdFTP
has a DirectoryListing
collection that you can loop through after calling TIdFTP.List()
. TIdFTP
有一个DirectoryListing
集合,您可以在调用TIdFTP.List()
之后循环遍历。 Each item in the collection has FileName
, ItemType
, and ModifiedDate
properties, amongst many others. 集合中的每个项目都具有FileName
, ItemType
和ModifiedDate
属性,以及许多其他属性。
There are many FTP listing formats used online, and Indy implements many parsers for them, however most of the parsers are not enabled by default. 在线使用了许多FTP列表格式,并且Indy为此实现了许多解析器,但是默认情况下,大多数解析器均未启用。 If the FTP server(s) you are connecting to do not support the MLSD
command (that parser is always enabled), and/or you are setting the TIdFTP.UseMLIS
property to false, then you will need to either: 如果您要连接的FTP服务器不支持MLSD
命令(始终启用该解析器),并且/或者将TIdFTP.UseMLIS
属性设置为false,那么您将需要:
add individual IdFTPListParse...
units to your uses
clause to enable just the parsers for the particular formats that you want to support. 将单独的IdFTPListParse...
单元添加到您的uses
子句中,以仅启用要支持的特定格式的解析器。
add the IdAllFTPListParsers
unit to your uses
clause to enable all of the parsers. 在添加IdAllFTPListParsers
单元您uses
条款,以使所有的解析器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.