few things i know. Folders are not an S3 concept; they are just a zero byte object with key names that use the '/' prefix. Assuming we call them folders and files for simplicity, my question will be easier to formulate.
You can do s3-> get_object_list (..) with the prefix = "root /" and get all the files / folders. My problem is this.
Given a list of folders and subfolders, e.g.
root/ root/folder1/ root/folder1/file1.txt root/folder2/ root/folder3/file2.txt
How can I list only folders. I was hoping to prevent all files from being listed (even in response, they do not need to be returned), but get_object_list in php does not support current support for commonPrefixes ref: http://docs.amazonwebservices.com/AWSSDKforPHP/latest/#m=AmazonS3/get_object_list even though the fact that the document says that the code is clearly not working and using a delimiter will actually return the files to the root folder (prefix)
I am wondering if any method used a post-response or request based on help in such a situation.
I have already tried every combination of prefix, delimiter, and marker that I could think of. Not so good with PCRE, but I'm sure I can use it, I have only one level of deep folders, but I donβt know how to build it for this case. Since my requests did not work, I continued to accept the answer with all the files and folders and hopefully sorted it in php ... or so I thought
I tried to answer in response: dirname () - do not use the omissions of some folders (empty), of course, I can delete duplicates in the array, but the problem of the missing folder exists pathinfo () - behaves the same as dirname (), assumes that all paths end with a file name. glob - no luck, same as above.
Since I already wasted half a day on this, I hope someone can handle this and want to share:
note: I have no problem with this in python and boto. But this is not python, and I have to do it in PHP for this project.