The FTP LIST command displays a listing of all the files and directories in the current working directory. The problem is, it returns several different formats depending on the server. Does anybody know of a .NET library that is able to parse the most popular formats? I am OK with a "try this regex, if it fails, try the next regex" approach.
相关问题
- Generic Generics in Managed C++
- How to Debug/Register a Permanent WMI Event Which
- 'System.Threading.ThreadAbortException' in
- Bulk update SQL Server C#
- Should I use static function in c# where many call
Here is a RegEx I used on a project. Seems to work for both Windows and Unix based FTP servers. Someone might be able to clean it up but I build it by concatenating a bunch of properties on a class. So it's not as brutal to maintain for me.
Changed Chris Haas version a tiny little bit. Changed so that the day grouping can consist of a single number as well. \d{2} -> \d{1,2}
Thanks for original version.
On the site I'm on, the owner is displayed in Email address format. I changed owner and group to be non-space characters instead of word characters.
This is expanding on Yodiz' version of Chris Haas' version. Thanks so much!
Here's the one that I've been using for a FileZilla server:
http://chrishaas.wordpress.com/2009/06/10/regex-for-parsing-ftp-list-command/