diff --git a/googlecloudstorage/googlecloudstorage.go b/googlecloudstorage/googlecloudstorage.go index 86a054ee0..f16043fa9 100644 --- a/googlecloudstorage/googlecloudstorage.go +++ b/googlecloudstorage/googlecloudstorage.go @@ -407,11 +407,14 @@ func (f *Fs) Mkdir() error { return err } -// Rmdir deletes the bucket +// Rmdir deletes the bucket if the fs is at the root // // Returns an error if it isn't empty: Error 409: The bucket you tried // to delete was not empty. func (f *Fs) Rmdir() error { + if f.root != "" { + return nil + } return f.svc.Buckets.Delete(f.bucket).Do() } diff --git a/s3/s3.go b/s3/s3.go index fc97c7de5..99a5a310e 100644 --- a/s3/s3.go +++ b/s3/s3.go @@ -487,10 +487,13 @@ func (f *Fs) Mkdir() error { return err } -// Rmdir deletes the bucket +// Rmdir deletes the bucket if the fs is at the root // // Returns an error if it isn't empty func (f *Fs) Rmdir() error { + if f.root != "" { + return nil + } req := s3.DeleteBucketInput{ Bucket: &f.bucket, } diff --git a/swift/swift.go b/swift/swift.go index d48074346..eb6d0db2e 100644 --- a/swift/swift.go +++ b/swift/swift.go @@ -371,10 +371,13 @@ func (f *Fs) Mkdir() error { return f.c.ContainerCreate(f.container, nil) } -// Rmdir deletes the container +// Rmdir deletes the container if the fs is at the root // // Returns an error if it isn't empty func (f *Fs) Rmdir() error { + if f.root != "" { + return nil + } return f.c.ContainerDelete(f.container) }