How to retrieve only root level objects

30 views
Skip to first unread message

Slawomir Jasinski

unread,
May 26, 2011, 12:33:37 AM5/26/11
to gs-dis...@googlegroups.com

I'm using getBucket function to retrieve elements in my bucket - pretty simple :)

I can use delimiter to restrict a list of objects which im getting from bucket, but if I use / as a delimiter I'm getting only objects in the "root" of bucket. 

I'm interested with "directory like" browsing, I want to fetch objects which are files in bucket, but only in root directory, and folders from the root of the bucket - it's any chance to actually do this? I notice, that empty folders are objects with key + _$folder$ at the end... but is there is any way to recognize actually not empty folders?

Jerjou Cheng

unread,
May 27, 2011, 12:19:52 PM5/27/11
to gs-dis...@googlegroups.com
Hello-

Sorry; I'm having some trouble understanding what you want to do. You mention that you _are_ able to get objects in the root of the bucket - are you trying to get objects that _aren't_ in the root of the bucket?

What you're probably looking for is the 'marker' and 'prefix' parameters for the getBucket function. Have you tried using those?

As for the $folder$ postfix, an explanation for that is here:


Cheers,
-Jerjou

--
You received this message because you are subscribed to the Google Groups "Google Storage for Developers" group.
To post to this group, send email to gs-dis...@googlegroups.com.
To unsubscribe from this group, send email to gs-discussio...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gs-discussion?hl=en.



--
Developer Programs Engineer
Google Storage

Slawomir Jasinski

unread,
Jun 2, 2011, 2:26:29 AM6/2/11
to gs-dis...@googlegroups.com
Lets assume that I have this objects in my bucket

books/book1.pdf
books/book2.pdf
movies/movie1.avi
movies/movie2.avi
picture1.jpg
picture2.jpg

when I'm using delimiter='/' I will get only picture1.jpg and picture2.jpg - when delimiter is empty, I'll everything.
I would like to get something like this:

books/
movies/
picture1.jpg
picture2.jpg


Jerjou Cheng

unread,
Jun 6, 2011, 5:52:17 PM6/6/11
to gs-dis...@googlegroups.com
Hello-

Have you checked the 'commonprefixes' element?


-Jerjou

--
You received this message because you are subscribed to the Google Groups "Google Storage for Developers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/gs-discussion/-/OHBmdTJ0QnZjVWdK.

To post to this group, send email to gs-dis...@googlegroups.com.
To unsubscribe from this group, send email to gs-discussio...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gs-discussion?hl=en.
Reply all
Reply to author
Forward
0 new messages