首先我问:ftp 目录列表超时.大量的子目录.我得到了答案.
First I asked that: ftp directory listing timeout. Huge number of subdirs. I got the answer.
仍然因为我的目录中可以有数十万个 FTP 对象,所以扫描它可能需要很长时间.但是我认为有可能检索以A"开头然后是B"等等的所有对象......当它检索目录时,它可以开始在另一个线程上处理它们而无需等到它获得整个列表.
Still because I can have hundred thousands of FTP objects in the directory it could take really long time to scan that. However I thought it might be possible to retrieve all the objects that begin with 'A' and then 'B' and so on... As it retrieves directories it could start processing them on the other thread without waiting till it gets the entire list.
是否可以使用标准 FtpWebRequest
使用通配符来列出 FTP 目录?
Is it possible to do FTP directory listing with wildcards using standard FtpWebRequest
?
FTP 规范 (RFC 3659) 明确禁止它.来自该规范的 第 2.2.2 节,标题为通配符"(强调我的):
The most recent update to the FTP specification (RFC 3659) explicitly forbids it. From section 2.2.2 of that specification, titled "Wildcarding" (emphasis mine):
对于本规范中定义的命令,所有路径名都是从字面上看.也就是说,对于作为参数给出的路径名一个命令,其名称与给定路径名相同的文件是默示.路径名中的任何字符都不能被视为特殊字符或魔术",因此没有模式匹配(除了完全相等)在给定的路径名和 NVFS 中存在的文件之间允许服务器-FTP.
For the commands defined in this specification, all pathnames are to be treated literally. That is, for a pathname given as a parameter to a command, the file whose name is identical to the pathname given is implied. No characters from the pathname may be treated as special or "magic", thus no pattern matching (other than for exact equality) between the pathname given and the files present in the NVFS of the server-FTP is permitted.
需要某种形式的模式的客户匹配功能必须获得相关的列表目录,或目录,并实现自己的文件名选择程序.
也就是说,如果您的服务器支持它,您仍然可以使用 FtpWebRequest
类,但您必须自己处理响应以处理项目列表,因为 .NET 类无法理解您的服务器特定扩展.
That said, if your server supports it, you could still use the FtpWebRequest
class, but you'd have to process the response yourself to handle the list of items, as the .NET classes won't understand your server-specific extensions.
这篇关于带有通配符的 FTP 目录部分列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!