We Want to Hear From You! What Do You Want to See on the Community? Tell us here!
Forum Discussion
victorvlad
7 years agoExplorer | Level 3
When listing files in a path using api v2, is there a limit of any kind ?
final DbxClientV2 dbxClient = dropboxService.getDropboxClient(user.getAccessToken()); try { final ListFolderResult listResult = dbxClient.files() .listFolderBuilder(path) .withRecursive(true) .start(); ....
}
Using this piece of code, I get as a result a single folder but in reality that's not the case. This behavior just started to happen today. Up until today, the result contained all files/folders that actually exist in that path... so I was wondering if there is any limit in size or number of files based on which the result object is populated...
The folder I'm trying to list from, contains 3.5K files, with a total of 7GB in size..
I see you're using listFolderBuilder, but aren't calling listFolderContinue. You aren't always guaranteed to get all entries returned by calling just listFolder. You need to check the result, and if ListFolderResult.hasMore is true, call back to listFolderContinue to get more results (and the same for the listFolderContinue result). You can find more information in the listFolder documentation.
Whether or not hasMore actually comes back as true in practice depends on a variety of factors that can change over time, per account, and per path.
4 Replies
- Greg-DB7 years ago
Dropbox Community Moderator
I see you're using listFolderBuilder, but aren't calling listFolderContinue. You aren't always guaranteed to get all entries returned by calling just listFolder. You need to check the result, and if ListFolderResult.hasMore is true, call back to listFolderContinue to get more results (and the same for the listFolderContinue result). You can find more information in the listFolder documentation.
Whether or not hasMore actually comes back as true in practice depends on a variety of factors that can change over time, per account, and per path.
- victorvlad7 years agoExplorer | Level 3
hi Greg,
Thanks for your quick reply. Indeed after looping on the .hasMore() i was able to get all my entries. So your suggestion fixed my problem. However, I am curious why did this behavior occur just now, since I've been using the approach you saw in my post for the last 2 years or so and I was getting all the entries in a single call.
-victor
- Greg-DB7 years ago
Dropbox Community Moderator
The requirement to use listFolderContinue has always been part of API v2, but the amount of entries you get back per page can vary due to a number of things that can change over time. I can't say exactly what caused the change in this particular case, so just make sure you always have listFolderContinue implemented as documented so you can make sure to get everything.
- victorvlad7 years agoExplorer | Level 3
Ok. Got it. Thanks ! Have a nice day !
-victor
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,037 PostsLatest Activity: 57 minutes ago
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!