问题描述
我正在创建一个服务来监控 FTP 位置是否有新的更新,并且需要能够使用 WebRequestMethods.Ftp.ListDirectoryDetails 解析从 FtpWebRequest 响应返回的响应方法.如果所有响应都遵循相同的格式,那将相当容易,但不同的 FTP 服务器软件提供不同的响应格式.
I'm creating a service to monitor FTP locations for new updates and require the ability to parse the response returned from a FtpWebRequest response using the WebRequestMethods.Ftp.ListDirectoryDetails method. It would be fairly easy if all responses followed the same format, but different FTP server software provide different response formats.
例如,可能会返回:
08-10-11 12:02PM <DIR> Version2
06-25-09 02:41PM 144700153 image34.gif
06-25-09 02:51PM 144700153 updates.txt
11-04-10 02:45PM 144700214 digger.tif
另一个服务器可能会返回:
And another server might return:
d--x--x--x 2 ftp ftp 4096 Mar 07 2002 bin
-rw-r--r-- 1 ftp ftp 659450 Jun 15 05:07 TEST.TXT
-rw-r--r-- 1 ftp ftp 101786380 Sep 08 2008 TEST03-05.TXT
drwxrwxr-x 2 ftp ftp 4096 May 06 12:24 dropoff
还观察到了其他差异,因此可能存在一些我尚未遇到的细微差异.
And other differences have been observed also so there's likely to be a number of subtle differences I haven't encountered yet.
有谁知道可以无缝处理这些情况的完全托管(不需要访问 Windows 上的外部 dll)C# 类?
Does anyone know of a fully managed (doesn't require access to external dll on Windows) C# class that handles these situations seamlessly?
我只需要列出具有以下详细信息的目录的内容:文件/目录名称、上次更新或创建的时间戳、文件/目录名称.
I only need to list the contents of a directory with the following details: File/directory name, last updated or created timestamp, file/directory name.
提前感谢您的任何建议,加文
Thanks in advance for any suggestions, Gavin
推荐答案
我遇到的一个解决方案是 EdtFTPnet
One solution I came across is EdtFTPnet
EdtFTPnet 似乎是一个功能丰富的解决方案,可以处理许多不同的 FTP 选项,因此非常理想.
EdtFTPnet seems to be quite a feature packed solution that handles lots of different FTP options so is ideal.
这是我为 http://www.ftp2rss.com 使用的免费开源解决方案(我自己需要一个小工具,但认为对其他人也可能有用).
It's the free open source solution that I've how employed for http://www.ftp2rss.com (a little tool I needed myself but figured might be useful to others also).
这篇关于解析 WebRequestMethods.Ftp.ListDirectoryDetails FTP 响应的 C# 类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!