aws-sdk-go s3在存储桶之间移动目录

I would like to know how can I move a directory inside the same bucket. I didn't had any problem to move one specific file inside the same bucket with CopyObject but not a directory

This is the error I have after running the code below.

Unable to copy item from bucket "bucketName" to bucket "bucketName", NoSuchKey: The specified key does not exist.

dir := "newPlace/directory"
source := bucket + "/directory"

// Copy the item
_, err = svc.CopyObject(&s3.CopyObjectInput{Bucket: aws.String(bucket), CopySource: aws.String(source), Key: aws.String(dir)})
if err != nil {
    exitErrorf("Unable to copy item from bucket %q to bucket %q, %v", bucket, bucket, err)
}

//Wait to see if the item got copied
err = svc.WaitUntilObjectExists(&s3.HeadObjectInput{Bucket: aws.String(bucket), Key: aws.String(dir)})
if err != nil {
    exitErrorf("Error occurred while waiting for item %q to be copied to bucket %q, %v", bucket, item, bucket, err)
}

fmt.Printf("Item %q successfully copied from bucket %q to bucket %q
", item, bucket, bucket)

My last solution was to COPY + DELETE each file from my directory but I am surprised that they didn't implement a move directory in the SDK and the mv is also available in the aws-cli-s3

Thanks in advance,

The SDK does have support for batch operation. This should allow you to use the batch download iterator and write your own iterator for upload