Rajaraman
Rajaraman

Reputation: 1677

How can I get a file list for a folder in my AWS bucket?

I am working on AWS S3 using Amazon S3 PHP Class (version 0.5.1-dev). I can get a list of all buckets using $s3->listBuckets().

How do I get a list of all files in a folder?

Upvotes: 2

Views: 5904

Answers (2)

Ryan Parman
Ryan Parman

Reputation: 6935

To be clear, you're not talking about Amazon's PHP class for S3. You're talking about the PHP class for Amazon S3. (This is an unofficial, third-party class that is not supported by AWS.) If this is what you're using, you're looking for the S3::getBucket() method.

If you're looking for documentation on the official AWS SDK for PHP 1.6.2, you're looking for the AmazonS3::list_objects() method.

If you're looking for documentation on the official AWS SDK for PHP 2.x, you're looking for the Aws\S3\S3Client::listObjects() method.

Upvotes: 1

user149341
user149341

Reputation:

You can list objects in a bucket by using the list_objects() function.

Note that the version of the Amazon S3 SDK you're using is old. You may have better results using version 2 of the AWS SDK.

Upvotes: 0

Related Questions