diff --git a/cmd/client-fs.go b/cmd/client-fs.go index 86bc1063..271fa48e 100644 --- a/cmd/client-fs.go +++ b/cmd/client-fs.go @@ -489,6 +489,9 @@ func (f *fsClient) Remove(isIncomplete, isRemoveBucket bool, contentCh <-chan *c if os.IsPermission(err) { // Ignore permission error. errorCh <- probe.NewError(PathInsufficientPermission{Path: content.URL.Path}) + } else if os.IsNotExist(err) && isRemoveBucket { + // ignore PathNotFound for dir removal. + return } else { errorCh <- probe.NewError(err) return diff --git a/cmd/client-s3.go b/cmd/client-s3.go index 1590b4ed..bde243ad 100644 --- a/cmd/client-s3.go +++ b/cmd/client-s3.go @@ -21,6 +21,7 @@ import ( "context" "crypto/tls" "encoding/json" + "errors" "hash/fnv" "io" "net" @@ -884,6 +885,12 @@ func (c *s3Client) Remove(isIncomplete, isRemoveBucket bool, contentCh <-chan *c go func() { defer close(errorCh) + if isRemoveBucket { + if _, object := c.url2BucketAndObject(); object != "" { + errorCh <- probe.NewError(errors.New("cannot delete prefixes with `mc rb` command - Use `mc rm` instead")) + return + } + } for content := range contentCh { // Convert content.URL.Path to objectName for objectsCh. bucket, objectName := c.splitPath(content.URL.Path)