0
votes

Here is what I'm currently trying to do:

 $key = 'keywithsomeID';
 $blobListOptions = new ListBlobsOptions();
 $blobListOptions->setPrefix($key);

 $blob_list = $blobClient->listBlobs($container, $blobListOptions);
 $blobs = $blob_list->getBlobs();

Now, what I get returned is the following:

FolderA/Subfolder/FileA FolderA/File1 FolderA/File2 FolderA/File3

And really I'd just like to specify some option where I only get the result "FolderA".

Any thoughts? I feel like I'm missing something but also the PHP SDK is not particularly well-documented or helpful.

Edit: The github being used: https://github.com/Azure/azure-storage-php

1
Please try to add following line of code $blobListOptions->setDelimiter("/"); after $blobListOptions->setPrefix($key);. - Gaurav Mantri
This gives me an empty array. - D'Arcy Rail-Ip

1 Answers

1
votes

1) As @Gaurav pointed out, you'll need to specify the value / as delimiter option first.

2) You'll also need to replace the following line of code

$blobs = $blob_list->getBlobs();

with

$blobs = $blob_list->getBlobPrefixes();