I am trying to get the list of Object
under a specific folder in my bucket.
I know that to get a list of all of my objects I do:
$ob
The answer is above however i figured i would supply a complete working example that can be copied and pasted directly into a php file and ran
use Aws\S3\S3Client;
require_once('PATH_TO_API/aws-autoloader.php');
$s3 = S3Client::factory(array(
'key' => 'YOUR_KEY',
'secret' => 'YOUR_SECRET',
'region' => 'us-west-2'
));
$bucket = 'YOUR_BUCKET_NAME';
$objects = $s3->getIterator('ListObjects', array(
"Bucket" => $bucket,
"Prefix" => 'some_folder/' //must have the trailing forward slash "/"
));
foreach ($objects as $object) {
echo $object['Key'] . "
";
}