I'm storing all my application information in Google Cloud Storage. I've created a bucket and inside this bucket I've folders. With that code, I can get list of all my folders.
public static IList<uFolder> ListFolders(string bucketName)
{
if (storageService == null)
{
CreateAuthorizedClient();
}
Objects objects = storageService.Objects.List(bucketName).Execute();
if (objects.Items != null)
{
return objects.Items.
Where(x => x.ContentType == "application/x-www-form-urlencoded;charset=UTF-8").
Select(x => new uFolder(x.Name)).ToList();
}
return null;
}
But actually this code, get all my files and folders in my bucket. So I need to be extract them. My first question, Is there a shortcut to this method?
My other and most important question is, How can I get all files just in specific folder? For example; My bucket name is MyBucket and I want to get all files from "MyBucket/2/". How can I do this? Is this the only way check the medialink or selflink of the files?
Thanks for all answer. Have a good day, good works...
I think what you want is to set the Delimiter property of the list request to /
. This will return a delimited result at the top level of your hierarchy.