1
0
mirror of https://github.com/minio/mc.git synced 2025-11-28 08:03:56 +03:00

cp: Copy recursive paths having the passed prefix (#3563)

This commit is contained in:
Anis Elleuch
2021-01-24 09:06:40 +01:00
committed by GitHub
parent 7e19044d98
commit 130f4393bb
5 changed files with 35 additions and 22 deletions

View File

@@ -200,6 +200,19 @@ func url2Stat(ctx context.Context, urlStr, versionID string, fileAttr bool, encK
return client, content, nil
}
// firstURL2Stat returns the stat info of the first object having the specified prefix
func firstURL2Stat(ctx context.Context, prefix string, timeRef time.Time) (client Client, content *ClientContent, err *probe.Error) {
client, err = newClient(prefix)
if err != nil {
return nil, nil, err.Trace(prefix)
}
content = <-client.List(ctx, ListOptions{Recursive: true, TimeRef: timeRef, Count: 1})
if content.Err != nil {
return nil, nil, err.Trace(prefix)
}
return client, content, nil
}
// url2Alias separates alias and path from the URL. Aliased URL is of
// the form alias/path/to/blah.
func url2Alias(aliasedURL string) (alias, path string) {