1
0
mirror of https://github.com/minio/mc.git synced 2025-11-12 01:02:26 +03:00

support for "rm" of objects and buckets

This commit is contained in:
Krishna Srinivas
2015-10-17 00:46:12 -07:00
parent 2a3b201457
commit b4c78a33ff
7 changed files with 242 additions and 0 deletions

10
url.go
View File

@@ -85,3 +85,13 @@ func url2Stat(urlStr string) (client client.Client, content *client.Content, err
}
return client, content, nil
}
// just like filepath.Dir but always has a trailing url.Seperator
func url2Dir(urlStr string) string {
url := client.NewURL(urlStr)
if strings.HasSuffix(urlStr, string(url.Separator)) {
return urlStr
}
lastIndex := strings.LastIndex(urlStr, string(url.Separator))
return urlStr[:lastIndex+1]
}