Skip to content

Instantly share code, notes, and snippets.

@nowlinuxing
Created June 16, 2015 06:41
Show Gist options
  • Save nowlinuxing/6bf79c9ad757985854c3 to your computer and use it in GitHub Desktop.
Save nowlinuxing/6bf79c9ad757985854c3 to your computer and use it in GitHub Desktop.
How to get the folder list under the specify folder using AWS-SDK v2
require 'aws-sdk'
client = Aws::S3::Client.new(
access_key_id: "your_access_key_id",
secret_access_key: "your_access_key",
)
s3.list_objects(bucket: "your-bucket", prefix: "path/to/folder", delimiter: "/").common_prefixes.map(&:prefix)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment