cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted

Listing doesn't get deeper from the root folder

Explorer | Level 3

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 1
Highlighted

Re: Listing doesn't get deeper from the root folder

Dropboxer
Dropboxer

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.

Polls
Do you know how to organize your files and folders?
We have created a guide on folder best practice, so you can get organized now check it out here.

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?