3

I have a big amount of objects stored in Minio. I need to move them from one bucket to another. Due to the big amount of the objects (and the size of the objects themselves), I do not want to upload them into memory.

The only way I found so far is copying the objects to the destination bucket and removing them from the source bucket.

Is there a way to move them with one command (like mv)?

yaskovdev
  • 1,213
  • 1
  • 12
  • 22

3 Answers3

5

Since April 2020 the minio client utility does support move functionality:

$ mc mv -h
NAME:
  mc mv - move objects

USAGE:
  mc mv [FLAGS] SOURCE [SOURCE...] TARGET

FLAGS:
  --recursive, -r                    move recursively
  --older-than value                 move objects older than L days, M hours and N minutes
  --newer-than value                 move objects newer than L days, M hours and N minutes
  --storage-class value, --sc value  set storage class for new object(s) on target
  --encrypt value                    encrypt/decrypt objects (using server-side encryption with server managed keys)
  --attr value                       add custom metadata for the object
  --continue, -c                     create or resume move session
  --preserve, -a                     preserve filesystem attributes (mode, ownership, timestamps)
  --disable-multipart                disable multipart upload feature
  --encrypt-key value                encrypt/decrypt objects (using server-side encryption with customer provided keys)
  --config-dir value, -C value       path to configuration folder (default: "/Users/prerok/.mc")
  --quiet, -q                        disable progress bar display
  --no-color                         disable color theme
  --json                             enable JSON formatted output
  --debug                            enable debug output
  --insecure                         disable SSL certificate verification
  --help, -h                         show help

The S3 API does not support the move functionality so the mc utility is actually doing the copy first and then removal of the object. Source: https://github.com/minio/mc/blob/133dd1f7da237a91dc291cbf8f3a5ad66fffc425/cmd/mv-main.go#L363

Prerok
  • 106
  • 1
  • 3
4

@yaskovdev S3 API does not allow for mv like functionality. So, the steps that you have described are the only way to do that.

r1j1m1n1
  • 345
  • 1
  • 4
1

example :

    // Create object "my-objectname" in bucket "my-bucketname" by copying from object
// "my-objectname" in bucket "my-source-bucketname".
minioClient.copyObject(
    CopyObjectArgs.builder()
        .bucket("my-bucketname")
        .object("my-objectname")
        .source(
            CopySource.builder()
                .bucket("my-source-bucketname")
                .object("my-objectname")
                .build())
        .build());

more info here -> minio documents

OXYGEN
  • 229
  • 2
  • 10