Skip to content

How can I get list of all the files in storage ? #414

Open

Description

@adivaste

I wanna extract all the files in the particular firebase folder, how can I do ?

Activity

  1. hereisamara commented on Apr 10, 2022

    @hereisamara

    storage.child(folder_name).list_files()

  2. adivaste commented on Apr 14, 2022

    @adivaste
    Author

    Still Unable to extract files from particular folder, giving the same Object as output for both of the lines...
    ( Listing whole files from Firebase Storage )

    firebaseFiles = storage.list_files()
    firebaseFiles = storage.child("chartjs").list_files()

  3. hereisamara commented on Apr 15, 2022

    @hereisamara

    Please add service account json file as shown in picture.
    Then only the method will work,

    files = storage.child("pictures").list_files()
    for f in files:
        print(f)
    

    image

    p.s. After I have searched for a while, I found out the method used in pyrebase is deprecated, so you can only list all the files in the storage, not files from just one folder. Even if you use storage.child(folder).list_files(), it will still show all the files in the whole storage.

  4. hereisamara commented on Apr 15, 2022

    @hereisamara

    If you want files only from a particular folder, you can use this, where the prefix is your folder name followed by a /.

    files = storage.bucket.list_blobs(prefix="folder_name/")
    for f in files:
        print(f)
    
  5. adivaste commented on Apr 16, 2022

    @adivaste
    Author

    Yeah, I was doing it with a similar kind of method, but in this way, it might take a little more time.
    btw thanks for it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions