本文介紹了解析來自 FTP LIST 命令的響應(yīng)(語法變化)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
限時送ChatGPT賬號..
FTP LIST 命令顯示當前工作目錄中所有文件和目錄的列表.問題是,它會根據(jù)服務(wù)器返回幾種不同的格式.有人知道能夠解析最流行格式的 .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 服務(wù)器:
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/
這篇關(guān)于解析來自 FTP LIST 命令的響應(yīng)(語法變化)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!