解析来自 FTP LIST 命令的响应(语法变化)

Parse response from FTP LIST command (syntax variations)(解析来自 FTP LIST 命令的响应(语法变化))
本文介绍了解析来自 FTP LIST 命令的响应(语法变化)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

FTP LIST 命令显示当前工作目录中所有文件和目录的列表.问题是,它会根据服务器返回几种不同的格式.有人知道能够解析最流行格式的 .NET 库吗?我可以接受试试这个正则表达式,如果失败,试试下一个正则表达式"的方法.

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.

推荐答案

这是我一直在使用的 FileZilla 服务器:

Here's the one that I've been using for a FileZilla server:

^(?<dir>[-ld])(?<permission>([-r][-w][-xs]){3})s+(?<filecode>d+)s+(?<owner>w+)s+(?<group>w+)s+(?<size>d+)s+(?<timestamp>((?<month>w{3})s+(?<day>d{2})s+(?<hour>d{1,2}):(?<minute>d{2}))|((?<month>w{3})s+(?<day>d{1,2})s+(?<year>d{4})))s+(?<name>.+)$

http://chrishaas.wordpress.com/2009/06/10/regex-for-parsing-ftp-list-command/

这篇关于解析来自 FTP LIST 命令的响应(语法变化)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
quot;Overflowquot; compiler error with -9223372036854775808L(编译器错误-9223372036854775808L(Q;溢出Q))
Visual Studio 2010 ReportViewer Assembly References(Visual Studio 2010 ReportViewer程序集引用)
Weird behaviour when I open a reportviewer in WPF(在WPF中打开报表查看器时出现奇怪的行为)
how do i pass parameters to aspnet reportviewer(如何将参数传递给aspnet report查看器)