Parse response from FTP LIST command (syntax variations)

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

    ^(?[\-ld])(?([\-r][\-w][\-xs]){3})\s+(?\d+)\s+(?\S+)\s+(?\S+)\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+(?.+)$
    

    On the site I'm on, the owner is displayed in Email address format. I changed owner and group to be non-space characters instead of word characters.

    This is expanding on Yodiz' version of Chris Haas' version. Thanks so much!

提交回复
热议问题