cjhaas.com Basically a place that Chris can post solutions to problems so he can easily find them later

June 10, 2009

RegEx for parsing FTP LIST command

Filed under: Uncategorized — Tags: — Chris Haas @ 8:22 am

Need to parse the FTP LIST command output? I did. Here’s what I came up with, its based on another post that didn’t quite work for me. The code below works specifically on the FilZilla FTP Server which I was targetting.


^(?<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{2})s+(?<year>d{4})))s+(?<name>.+)$

Powered by WordPress