· 7 years ago · Aug 06, 2018, 05:46 AM
1How can I non-recursively browse the contents of a directory with the AWS S3 API?
2var request = new ListObjectsRequest()
3 .WithBucketName("bucketname")
4 .WithPrefix(@"folder1/")
5 .WithDelimiter(@"/");
6
7using (var client = Amazon.AWSClientFactory.CreateAmazonS3Client(accessKey, secretKey))
8using (var response = client.ListObjects(request))
9{
10 foreach (var item in response.CommonPrefixes)
11 {
12 /* ... */
13 }
14}