Merge pull request #141 from johnepiscopo/add-walk

Adds the ability to walk through a directory tree
This commit is contained in:
Julien Laffaye
2020-03-13 11:03:37 -04:00
committed by GitHub
3 changed files with 289 additions and 0 deletions

14
ftp.go
View File

@@ -701,6 +701,20 @@ func (c *ServerConn) RemoveDir(path string) error {
return err
}
//Walk prepares the internal walk function so that the caller can begin traversing the directory
func (c *ServerConn) Walk(root string) *Walker {
w := new(Walker)
w.serverConn = c
if !strings.HasSuffix(root, "/") {
root += "/"
}
w.root = root
return w
}
// NoOp issues a NOOP FTP command.
// NOOP has no effects and is usually used to prevent the remote FTP server to
// close the otherwise idle connection.