Parse response from FTP LIST command (syntax variations)

后端 未结 4 1705
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-06 07:16

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

4条回答
  •  醉话见心
    2021-01-06 07:44

    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.

    ^((?([dD]{1}))|)(?(.*))\s(?([0-9]{1,}))\s(?((?((?(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec))\s(?([0-9\s]{2}))))\s(\s(?([0-9]{4}))|(?

提交回复
热议问题