Skip to content
This repository has been archived by the owner on Sep 22, 2022. It is now read-only.

Commit

Permalink
Merge pull request dutchcoders#4 from zaz600/fix-parseunixlist
Browse files Browse the repository at this point in the history
fix parseUnixLIST
  • Loading branch information
VincenzoLaSpesa committed Jan 4, 2016
2 parents 81c0224 + 23d044f commit e1db549
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ftp_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,14 @@ func (ftp *FTP) parseNLST(data []string, basePath string) (files []string, direc
// Parse the response of a LIST
// Return an array with the files, one with the directories and one with the links
func (ftp *FTP) parseUnixLIST(data []string, basePath string) (files []string, directories []string, links []string, err error) {
var pattern = regexp.MustCompile(`([-ld])([-rwx]+)\s{2,}\d+\s(\d|\w+)\s{2,}(\(\?\)|\d+|\w+)\s{2,}(\d+)\s*(\w+\s*\d+\s*\d+\:*\d*)\s(\S+)`)
var pattern = regexp.MustCompile(`([-ld])` + //dir,link flags -dbclps
`([-rwxs]+)\s+` + //permissions
`\d+\s+` + //items count
`([\d\w\-]+)\s+` + //owner
`(\(\?\)|[\d\w\-]+)\s+` + //group
`(\d+)\s*` + //size
`(\w+\s*\d+\s*\d+\:*\d*)\s+` + //date|time
`(\S+)` /*name*/)
for _, line := range data {
match := pattern.FindStringSubmatch(line)
/*for i, val := range match {
Expand Down

0 comments on commit e1db549

Please sign in to comment.