Determining the Path for Getting a List of Files in a Bucket

43 views
Skip to first unread message

Richard Harden

unread,
Jun 27, 2016, 11:58:54 AM6/27/16
to Google App Engine

I am working in C# and need to get a list of the files in a bucket. I am trying to determine the structure of the path. I tried the following and it did not find the directory.


            string Path = "/storage/v1/b/BucketName..appspot.com/o/";
            if (Directory.Exists(Path))
            {
                string[] fileEntries = Directory.GetFiles(Path);
                foreach (string FileName in fileEntries) 
                    litFiles.Text = FileName.ToString();


            }

Nicholas (Google Cloud Support)

unread,
Jun 29, 2016, 11:47:24 AM6/29/16
to Google App Engine
Thank you for posting your questions here.

From what I can tell, you are using Directory.GetFiles to try to get the a list of files in a given bucket.  In effect, the simplest way to get an object list in a given bucket is to use the C# client API service with the Objects.List method.  This client library is essentially a collection of C# methods/objects wrapped around the JSON API.  I do not know of any way to achieve this using GetFiles.

If a list of objects is not what you were looking for, please describe what other information you are attempting to get from your bucket and we'll do our best to point you in the effective direction.  Hope this helps!
Reply all
Reply to author
Forward
0 new messages