Parse response from FTP LIST command (syntax variations)

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

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

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

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

提交回复
热议问题