listObjects

command module
v0.0.0-...-68f2935 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

README

Amazon S3 ListObjectsV2 Example

This is an example using the AWS SDK for Go to list objects in a S3 bucket.

Usage

The example uses the bucket name provided, and lists all object keys in a bucket. Optionally taking a prefix to filter object with that prefix, and separator.

go run listObjects.go -bucket <bucket-name> [-prefix <string>] [-delimiter <string>] [-max-keys <int>]

  -bucket name
        The name of the S3 bucket to list objects from.
  -delimiter object key delimiter
        The optional object key delimiter used by S3 List objects to group object keys.
  -max-keys keys per page
        The maximum number of keys per page to retrieve at once.
  -prefix object prefix
        The optional object prefix of the S3 Object keys to list.
Output:
Objects:
Object: myKey
Object: mykey.txt
Object: resources/0001/item-01
Object: resources/0001/item-02
Object: resources/0001/item-03
Object: resources/0002/item-01
Object: resources/0002/item-02
Object: resources/0002/item-03
Object: resources/0002/item-04
Object: resources/0002/item-05

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL