README.md
1# Amazon S3 ListObjectsV2 Example
2
3This is an example using the AWS SDK for Go to list objects in a S3 bucket.
4
5### Usage
6
7The example uses the bucket name provided, and lists all object keys in a bucket.
8Optionally taking a prefix to filter object with that prefix, and separator.
9
10```
11go run listObjects.go -bucket <bucket-name> [-prefix <string>] [-delimiter <string>] [-max-keys <int>]
12
13 -bucket name
14 The name of the S3 bucket to list objects from.
15 -delimiter object key delimiter
16 The optional object key delimiter used by S3 List objects to group object keys.
17 -max-keys keys per page
18 The maximum number of keys per page to retrieve at once.
19 -prefix object prefix
20 The optional object prefix of the S3 Object keys to list.
21```
22
23### Output:
24
25```
26Objects:
27Object: myKey
28Object: mykey.txt
29Object: resources/0001/item-01
30Object: resources/0001/item-02
31Object: resources/0001/item-03
32Object: resources/0002/item-01
33Object: resources/0002/item-02
34Object: resources/0002/item-03
35Object: resources/0002/item-04
36Object: resources/0002/item-05
37```
38