RFC3659: add support for MLSD directory listing
When supported by the remote server, one of the benefits is a precise last modification time compared to the default LIST command.
This commit is contained in:
parent
7240d6ebcf
commit
243b4cbc1f
15
ftp.go
15
ftp.go
@ -534,7 +534,20 @@ func (c *ServerConn) NameList(path string) (entries []string, err error) {
|
||||
|
||||
// List issues a LIST FTP command.
|
||||
func (c *ServerConn) List(path string) (entries []*Entry, err error) {
|
||||
conn, err := c.cmdDataConnFrom(0, "LIST %s", path)
|
||||
var conn net.Conn
|
||||
|
||||
commands := []string{"MLSD", "LIST"}
|
||||
if _, mlstSupported := c.features["MLST"]; !mlstSupported {
|
||||
commands = commands[1:]
|
||||
}
|
||||
|
||||
for _, cmd := range commands {
|
||||
conn, err = c.cmdDataConnFrom(0, "%s %s", cmd, path)
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user