Added NLST-equivalent command
This commit is contained in:
parent
962edd16c2
commit
a40f117d27
20
ftp.go
20
ftp.go
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user