Use the Start File Name Parameter in the Native API
    • Dark
      Light

    Use the Start File Name Parameter in the Native API

    • Dark
      Light

    Article Summary

    This article provides details about the startFileName parameter in the b2_list file_names API.

    For all of the Backblaze API operations and their corresponding documentation, see API Documentation.

    The following example shows a bucket's possible folder structure.

    cats/
      photo1.jpg
      photo2.jpg
    kittens/
      video1.jpg
      video2.jpg
    cats-readme.txt

    If you want the files and folder structure at the level "cats," the prefix for startFileName should be cats/.

    If you want the file and folder structure at the level "kittens," the prefix for startFileName prefix should be cats/kittens/.

    The trailing slash is important. Without it, the first file in the list that should be returned would be cats-readme.txt instead of cat/photo1.jpg.

    For each bucket, Backblaze B2 keeps an internal, alphabetically sorted list of the files in that bucket. When you specify a startFileName, it gives you that file and the next 1000 files (of the number given to maxFileCount).

    The folder structure example above would be returned by b2_list_file_names in alphabetical order:

    cats-readme.txt
    cats/photo1.jpg
    cats/photo2.jpg
    kittens/video1.jpg
    kittens/video2.jpg

    Was this article helpful?


    What's Next