- Print
- DarkLight
Use the Start File Name Parameter in the Native API
- Print
- DarkLight
This article provides details about the startFileName
parameter in the b2_list file_names API.
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 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