From 6cc783f20bcab9e87f9054604190ef3558e80e73 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 18 May 2017 15:52:28 +0100 Subject: [PATCH] ftp: stop rmdir being recursive --- ftp/ftp.go | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/ftp/ftp.go b/ftp/ftp.go index b856aeacc..fa3da5822 100644 --- a/ftp/ftp.go +++ b/ftp/ftp.go @@ -414,27 +414,9 @@ func (f *Fs) Mkdir(dir string) (err error) { // // Return an error if it doesn't exist or isn't empty func (f *Fs) Rmdir(dir string) error { - // This is actually a recursive remove directory c, err := f.getFtpConnection() if err != nil { - return errors.Wrap(err, "Rmdir") - } - files, err := c.List(path.Join(f.root, dir)) - f.putFtpConnection(&c) - if err != nil { - return translateErrorDir(err) - } - for _, file := range files { - if file.Type == ftp.EntryTypeFolder && file.Name != "." && file.Name != ".." { - err = f.Rmdir(path.Join(dir, file.Name)) - if err != nil { - return errors.Wrap(err, "rmdir") - } - } - } - c, err = f.getFtpConnection() - if err != nil { - return errors.Wrap(err, "Rmdir") + return errors.Wrap(translateErrorFile(err), "Rmdir") } err = c.RemoveDir(path.Join(f.root, dir)) f.putFtpConnection(&c)