Parse response from FTP LIST command (syntax variations)

后端 未结 4 1707
爱一瞬间的悲伤
爱一瞬间的悲伤 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:27

    ^(?[\-ld])(?([\-r][\-w][\-xs]){3})\s+(?\d+)\s+(?\w+)\s+(?\w+)\s+(?\d+)\s+(?((?\w{3})\s+(?\d{1,2})\s+(?\d{1,2}):(?\d{2}))|((?\w{3})\s+(?\d{1,2})\s+(?\d{4})))\s+(?.+)$
    

    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.

提交回复
热议问题