Added NLST-equivalent command

This commit is contained in:
Bob Uhl 2013-12-03 17:09:55 -07:00
parent 962edd16c2
commit a40f117d27

20
ftp.go
View File

@ -302,6 +302,26 @@ func parseListLine(line string) (*Entry, error) {
return e, nil
}
// NameList issues an NLST FTP command.
func (c *ServerConn) NameList(path string) (entries []string, err error) {
conn, err := c.cmdDataConn("NLST %s", path)
if err != nil {
return
}
r := &response{conn, c}
defer r.Close()
scanner := bufio.NewScanner(r)
for scanner.Scan() {
entries = append(entries, scanner.Text())
}
if err = scanner.Err(); err != nil {
return entries, err
}
return
}
// List issues a LIST FTP command.
func (c *ServerConn) List(path string) (entries []*Entry, err error) {
conn, err := c.cmdDataConn("LIST %s", path)