how to rename objects in AWS s3 in c#

Viewed 47

I'm using AmazonS3Client in c# and I can't see any method to rename an object any idea how to do that?

private AmazonS3Client _client;

    public AWSBucketRepository(AmazonS3Client client)
    {
        _client = client;
    }

    public string RenameObject(string objectPath , string newObjectName)
    {
        
    }
1 Answers

As explained in the docs, you can copy object to itself with new name:

You can use copyObject with deleteObject to move or rename an object, by first copying the object to a new name (you can use the same bucket as both the source and destination) and then deleting the object from its old location.

Related