Cut the Clutter: Test Ignore Files Feature - sign up to become a beta tester here.
Forum Discussion
balipa
8 years agoExplorer | Level 3
Listing doesn't get deeper from the root folder
I'm trying to get a list of all files in the dropbox by using listFolder and listFolderContinue. However I only get the list of files/folders in the root, but it doesn't go deeper.
This is my code:
DbxRequestConfig config = new DbxRequestConfig("dropbox/java-tutorial", "en_US");
DbxClientV2 client = new DbxClientV2(config, ACCESS_TOKEN);
ListFolderResult result = client.files().listFolder("");
while (true) {
for (Metadata metadata : result.getEntries()) {
System.out.println(metadata.getPathLower());
}
if (!result.getHasMore()) {
break;
}
result = client.files().listFolderContinue(result.getCursor());
}
} catch (DbxException e) {
e.printStackTrace();
}
What I'm doing wrong?
Thank you for helping me!!
1 Reply
- Greg-DB8 years ago
Dropbox Community Moderator
If you want nested entries, you'll need to use listFolderBuilder to get a ListFolderBuilder on which you can use withRecursive and pass in true to tell Dropbox that you want a recursive listing result, i.e., to return nested items. You can call ListFolderBuilder.start to then start the call.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,038 PostsLatest Activity: 13 hours 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!