Add folder in Amazon s3 bucket

前端 未结 16 1335
青春惊慌失措
青春惊慌失措 2021-02-06 23:34

I want to add Folder in my amazon s3 bucket using coding. Can you please suggest me how to achieve this?

16条回答
  •  孤城傲影
    2021-02-06 23:46

    With AWS SDK .Net works perfectly, just add "/" at the end of the name folder:

    var folderKey =  folderName + "/"; //end the folder name with "/"
    AmazonS3 client = Amazon.AWSClientFactory.CreateAmazonS3Client(AWSAccessKey, AWSSecretKey);
    var request = new PutObjectRequest();
    request.WithBucketName(AWSBucket);
    request.WithKey(folderKey);
    request.WithContentBody(string.Empty);
    S3Response response = client.PutObject(request);
    

    Then refresh your AWS console, and you will see the folder

提交回复
热议问题