Quickstart-ios: Storage SDK: list all files under a dir?

Created on 5 Sep 2016  路  7Comments  路  Source: firebase/quickstart-ios

I wonder if there is a way to list all of the available files under a specific dir (folder)?

Most helpful comment

getting a dir list is a basic functionality, how can we get a dir listing. Do we have a bot getting the list out the console or something likw that ?

All 7 comments

There isn't unfortunately - the path is really just a structured unique identified. However, you can create a reference in the Firebase Realtime Database to the URL, and use that to query if you wanted to keep track - that will also allow arbitrary structuring of queries, but what many people do is mirror the path (so /foo/bar/file in Storage is referenced by /foo/bar/file in the database)

i try to find the way out, but still can't list all files under a dir

Yeah, it seems like an obvious addition. Amazon S3 has a similar setup with its buckets but also offers the ability to list a directory contents. Regardless of the potential ordering of contents, it would be better than nothing to just commit data into the ether and possibly forget about its contents. Using a database is not something we want to do. We ended up zipping up contents, which I hate having to do.

Hi everyone, I'd like to follow up on this. I've been searching and reading about similar question. I failed to save the metadata of each photo from Storage to the Database. And furthermore, unfortunately again, each file's name is very unique. The file is named as userId-timestamp. Though each file is saved under a unique folder named after each userId. If only I didn't put a timestamp data in their filenames, I think I'll be able to fetch those all files, but I did. --- Does it mean that I am doomed? There's no way to download all the files? Thanks!

Following up on this, there seems to be no way to get all list of files in firebase bucket. But, you can write a script update a firestore collection with all file metadata.

  1. Use gsutil ls gs://{{bucketname}} (or in case of firebase gsutil ls gs://{{project-id}}.appspot.com to get the list of files.

  2. The file url would be https://storage.cloud.google.com/{{project-id}}.appspot.com/{{path}} which is literally https://storage.cloud.google.com/ + whatever the command prints out per line after gs://. This would redirect to another URL. You can save that URL or this one. Being able to access this depends on your security rules.

@sourabhv can you provide an example with javascript please?

getting a dir list is a basic functionality, how can we get a dir listing. Do we have a bot getting the list out the console or something likw that ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

asciiman picture asciiman  路  7Comments

isipisi281 picture isipisi281  路  9Comments

Shingyien picture Shingyien  路  5Comments

zsajjad picture zsajjad  路  8Comments

glorment picture glorment  路  3Comments